Friday, March 9, 2012

How to read the column name?

Hello, everyone:
How to get the column name from a table? Thanks.
ZYTTwo ways to get column names:

select sc.name from syscolumns sc where sc.id = object_id('<tablename>')

OR

select * from <tablename> where 1=2

HTH.|||or:

select column_name
from information_schema.columns
where table_name = ...

No comments:

Post a Comment