Dropping DF_ constraints

  • HELP!! I have a deployment script that is building tables and setting default values to a column. I have built into it if exists, so that it can be rerunnable. The default constraints are system named when created I guess because they are funky names. So on the rerun, they are not being dropped due to the fact that I don't know those funky names. How do I drop the DFs when I don't know their names? Thank you in advance! :w00t:


    Thank you!!,

    Angelindiego

  • This should get you started. If you want to know the column to script it out you can use the parent_column_id and join to sys.columns.

    SELECT OBJECT_NAME(parent_object_id) AS TableName, name AS DefaultName,*

    FROM sys.default_constraints

  • Thank you Randy!!!!! Especially for your SPEEDY reply!!


    Thank you!!,

    Angelindiego

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply