October 22, 2015 at 12:36 pm
CREATE TABLE XYZ
(
ID int DEFAULT 5000,
NAME VARCHAR(100)
)
I have many tables that have many columns with default values
Is there a way to get a listing of
TAB_NAME, COL_NAME, Data_type, Default_Value
October 22, 2015 at 12:48 pm
Use the sys.default_constraints system view.
SELECT d.name, OBJECT_NAME( d.parent_object_id) , COL_NAME(d.parent_object_id, d.parent_column_id)
FROM sys.default_constraints d
October 22, 2015 at 12:51 pm
based on some of your other posts, it looks like you are trying to script out a table definition.
take a look at my procedure i wrote in this article and procedure, and grab the code you need from that:
http://www.sqlservercentral.com/Forums/Topic751783-566-8.aspx
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply