Pages

Wednesday, February 25, 2009

DataTypes in SQL Server

Use the below query to find out the data type of all the columns of a particular table .

SELECT syscolumns.name AS ColumnName, systypes.name AS Datatype
FROM sysobjects, syscolumns, systypes
WHERE sysobjects.id = syscolumns.id
AND syscolumns.xtype = systypes.xtype
AND sysobjects.name = 'table1'

In the above just replace the table1 with the your desired table.

No comments: