Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Dropping DF_ constraints Expand / Collapse
Author
Message
Posted Tuesday, November 13, 2012 10:05 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, April 9, 2014 1:53 PM
Points: 320, Visits: 413
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!


Thank you!!,

Angelindiego

Post #1384382
Posted Tuesday, November 13, 2012 10:16 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, September 3, 2014 11:45 PM
Points: 24, Visits: 152
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

Post #1384384
Posted Tuesday, November 13, 2012 10:41 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, April 9, 2014 1:53 PM
Points: 320, Visits: 413
Thank you Randy!!!!! Especially for your SPEEDY reply!!


Thank you!!,

Angelindiego

Post #1384390
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse