Monday 28 August 2017

Get the list all default values in a SQL Server Database

With the help of below sql query we will get the list of all default value in a sql server.
SELECT obj.name as 'Table', col.name as 'Column',
object_definition(default_object_id) AS [DefaultValue]
FROM   sys.objects obj INNER JOIN sys.columns col
ON obj.object_id = col.object_id
where obj.type = 'U'
See the output.

We can see in the default constraint

  

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts