Technical Article

How to get ColumnNames, datatypes and length

,

Very frequently I used to use sp_help to find column names, datatypes and length of datatypes.  Sp_help outputs a lot of data which i really don't require to see.  so I devised this script

select  sc.name as ColumnName,  st.name as ColumnDatatype,  convert(int, sc.length) as columnLength
from syscolumns sc, sysobjects so , systypes st
where so.type='U' and so.name='Authors' and sc.id=so.id
and st.xusertype=sc.xusertype

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating