Created
April 27, 2015 19:42
-
-
Save L3V147H4N/a94538cc074603b9a272 to your computer and use it in GitHub Desktop.
SQL Server Get Database Schemas
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 t.name AS TableName, | |
SCHEMA_NAME(t.schema_id) AS SchemaName, | |
c.name AS ColumnName, | |
tp.name as DataType | |
FROM sys.tables AS t | |
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID | |
INNER JOIN sys.types tp ON c.system_type_id = tp.system_type_id | |
WHERE | |
tp.name <> 'sysname' | |
ORDER BY TableName; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment