SQL Server: Find out default value of a column with a query

You can find the stored definition with the below (remember to adjust the column and table name to find to be ones relevant to your environment!)

SELECT object_definition(default_object_id) AS definition
FROM   sys.columns
WHERE  name="colname"
AND    object_id = object_id('dbo.tablename')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)