Created
June 13, 2018 09:47
-
-
Save Faz95210/5d502c874852f3d50e5cf7f5d9314b0c to your computer and use it in GitHub Desktop.
[Get columns list SQLserver] Get table's column in sql server #SQLServer
This file contains 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
SELECT c.name 'Column Name' | |
FROM sys.columns c | |
INNER JOIN sys.types t ON c.user_type_id = t.user_type_id | |
LEFT OUTER JOIN | |
sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id | |
LEFT OUTER JOIN | |
sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id | |
WHERE | |
c.object_id = OBJECT_ID('YOUR_TABLE_NAME') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment