Skip to content

Instantly share code, notes, and snippets.

@chastain
Created February 1, 2013 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chastain/4691515 to your computer and use it in GitHub Desktop.
Save chastain/4691515 to your computer and use it in GitHub Desktop.
List all columns and other relevant data in a table. Found online http://weblogs.sqlteam.com/joew/archive/2008/04/27/60574.aspx
SELECT
ORDINAL_POSITION
,COLUMN_NAME
,DATA_TYPE
,CHARACTER_MAXIMUM_LENGTH
,IS_NULLABLE
,COLUMN_DEFAULT
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = 'TableName'
ORDER BY
ORDINAL_POSITION ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment