Created
April 6, 2016 10:43
-
-
Save umair-me/bdba575e49350ae2bfe8f1577ef61365 to your computer and use it in GitHub Desktop.
List all columns in tables and views
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
SELECT | |
SO.NAME AS "Table Name" | |
, SC.NAME AS "Column Name" | |
, SM.TEXT AS "Default Value" | |
FROM | |
dbo.sysobjects SO | |
INNER JOIN | |
dbo.syscolumns SC | |
ON | |
SO.id = SC.id | |
LEFT JOIN | |
dbo.syscomments SM | |
ON | |
SC.cdefault = SM.id | |
WHERE | |
SO.xtype IN ('U' | |
,'V') | |
ORDER BY | |
SO.[name] | |
, SC.colid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment