Script to get a list of the columns in a table along with the data type, size of each of those columns

Niladri.Biswas
Posted by Niladri.Biswas under Sql Server category on | Points: 40 | Views : 735
Select
[Table Name] = so.name
,[Column Names] = sc.name
,[Data Type] = st.name
,[Size] = sc.length
,[Is Identity] = Case When sc.status = 0x80
Then 1 else 0
End
,[Is Computed] = sc.iscomputed
,[Column Order] = sc.colorder
FROM SysObjects so
Join SysColumns sc On so.id= sc.id
Join SysTypes st On sc.xtype = st.xusertype
Where so.Name = 'Specify table name'
Order By sc.colorder

Comments or Responses

Login to post response