Saturday, February 25, 2012

defaults in the DB

How do i know whats the default values on which table and which column and whats the default value

It should be like this

Table column constraint_name value

emp emp_id DF_emp_emp_no 1
emp join_date DF_emp_cur_date getdate()

How can i get these results on all the tables in my DB.

Thanks.sp_help '<table_name>'

After the column list of index(es), the proc will list any constraints by column name.|||select object_name(c.id)+'.'+col_name(c.id, c.colid)+' - '+
object_name(c.constid)+' value: '+text
from sysconstraints c
inner join syscomments sc on c.constid = sc.id
where(c.status & 5)= 5
and objectproperty(c.id,'IsMSShipped')= 0
order by object_name(c.id)|||Buy that man a drink!

No comments:

Post a Comment