Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find name of Default Constraint?
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00478230
Message ID:
00478238
Views:
23
>Hi All,
>
>Is there a way to find out the name of the Default Constraint that is created when you use the DEFAULT Clause of the CREATE TABLE statement?
>
>I haven't been able to find them in the INFORMATION_SCHEMA views. Currently, I ALTER the column and then cut and paste the name. I'd like to automate this in a stored procedure.


Ok. To find the DEFAULT Constraint on mc_mdsvc.svc_ln I can do this:
SELECT O.Name 
	FROM sysobjects O, syscolumns C
	WHERE O.Parent_Obj = OBJECT_ID('mc_mdsvc') 
	AND C.Id = OBJECT_ID('mc_mdsvc') 
	AND O.Id = C.Cdefault
	AND C.Name = 'svc_ln'
However, I've been told not to query the system tables directly. Is there an acceptable way to do this?
TIA,
Bill Armbrecht
VFP MCP
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform