>>> Programming >> MSSQL > SQL How to select column names from a table? (This page has been seen 533 times)
SQL How to select column names from a table?
If you want to now the Column names in a table you could do something like
this
SELECT column_name, data_type, character_maximum_length from information_schema.columns WHERE table_name = 'MyTable'
OR You could run the build in stored procedure in SQL
exec sp_columns MyTable
SELECT column_name, data_type, character_maximum_length from information_schema.columns WHERE table_name = 'MyTable'
OR You could run the build in stored procedure in SQL
exec sp_columns MyTable
Like
Dislike
Keywords for this article:
DATEDIFF || DATETIME || SQL || TSQL
Advertisement by Google
Comment:
Code Language:
Code:
Here you can paste a code example. It will then be processed by SyntaxHighlighter and formatted for easier readability.
Please remember to select the correct Code Language in the select above so the SyntaxHighlighter can highlight the code properly.
Code:
Please enter the code you see above
What is 4 + 9 =