I had earlier written a query to Find a Column Default value using T-SQL. Here’s how to find the default value of all columns in all tables of a databaseSELECT 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'The sys.objects and sys.columns provides us with the metadata needed to find the default values of all columns in a database. Read more: SQL Server curry
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'The sys.objects and sys.columns provides us with the metadata needed to find the default values of all columns in a database. Read more: SQL Server curry
0 comments:
Post a Comment