Created
February 7, 2019 15:00
-
-
Save seantunwin/72a5bd57d21bc1e72eb623b2370802e4 to your computer and use it in GitHub Desktop.
MSSQL: Get Table Coumns Names and Column Count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Get Column Name from a table | |
| SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = @table; | |
| -- Get total number of Columns | |
| SELECT COUNT(*) FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = @table; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment