Monday, January 2, 2012

List All The Column With Specific Data Types of Specific Table

Since we upgraded to SQL Server 2005 from SQL Server 2000, we have used following script to find out columns with specific datatypes many times. It is very handy small script.

select as ColumnName,
(select name from sys.types where user_type_id=c.user_type_id)as Type,
c.max_length as Size
from sys.columns c where object_id=
(select object_id from sys.objects where name='order' and type_desc='USER_TABLE')

No comments:

Post a Comment