Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Last active August 29, 2015 13:55
Show Gist options
  • Select an option

  • Save lonekorean/8756258 to your computer and use it in GitHub Desktop.

Select an option

Save lonekorean/8756258 to your computer and use it in GitHub Desktop.
SQL query for column information
SELECT
C.name AS ColumnName,
T.name As DataType,
C.max_length AS Length
FROM sys.columns AS C JOIN sys.types AS T ON C.user_type_id = T.user_type_id
WHERE c.object_id = OBJECT_ID('YOUR_TABLE_NAME_HERE')
ORDER BY c.column_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment