How to query information about a table

I need a sql query that will return the names of the columns of a sql server table. So for example, my .NET application calls a stored procedure and passes in the name of the table. The stored procedure should return all of the column names of the table. I can create the stored procedure, I just don't know the sql which will be used to query information about the table. Namely the column names. Can someone help me out?
LVL 2
brgdotnetcontractorAsked:
Who is Participating?
 
Deepak ChauhanSQL Server DBACommented:
You can query INFORMATION_SCHEMA.COLUMNS view.

select TABLE_CATALOG as dBName, TABLE_NAME, COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME='abc'
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.