SQL Server Admin
T-SQL Articles

November 14, 2010

Find Column Default Value using T-SQL – SQL Server




Here’s how to find the default value of a Column using T-SQL. We will find the default value of the UnitPrice column in the Products table of the Northwind database

SELECT object_definition(default_object_id) AS DefaultValue
FROM sys.columns
WHERE name = 'UnitPrice'
AND object_id = object_id('Products')

OUTPUT

image


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter



 
  Feedback:

comments

0 Responses to "Find Column Default Value using T-SQL – SQL Server"
 

Copyright © 2009-2011 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions