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

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: