Skip to content

Instantly share code, notes, and snippets.

@mikebeaton
Created April 11, 2020 13:44
Show Gist options
  • Save mikebeaton/403ad851572127e149f23f10ba05bf7e to your computer and use it in GitHub Desktop.
Save mikebeaton/403ad851572127e149f23f10ba05bf7e to your computer and use it in GitHub Desktop.
SELECT c.column_id, c.name
FROM sys.objects o
INNER JOIN sys.schemas s
ON o.schema_id = s.schema_id
AND s.name = @schema_name
INNER JOIN sys.columns c
ON o.object_id = c.object_id
WHERE o.name = @table_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment