Wednesday, June 02, 2010

How To List The Columns In Your Table

I wanted to inspect, in T-SQL code, the list of columns in a table I had created. This is how I did it:
select c.* from sysobjects o inner join syscolumns c on =
where o.xtype = 'U' and = 'myTableName'
And for reference, a handy page on the T-SQL system tables:

No comments:

Post a Comment