Select Columns from tables.

I have needed these methods over the years in different situations.  It pulls column names from tables.

select * from information_schema.columns where table_name = @table order by ordinal_position

OR

select * from sys.columns where object_id = OBJECT_ID(‘table_name’) order by column_id

Share on Facebook

Leave a Reply

Your email address will not be published. Required fields are marked *