Skip to content

Instantly share code, notes, and snippets.

@jonasgiehl
Created October 31, 2016 16:16
Show Gist options
  • Save jonasgiehl/16fe66b1774e7cad8125e5b24056cfc0 to your computer and use it in GitHub Desktop.
Save jonasgiehl/16fe66b1774e7cad8125e5b24056cfc0 to your computer and use it in GitHub Desktop.
Helps you to find tables and data structure infos
SELECT
o.Name 'Table Name',
c.name 'Column Name',
t.Name 'Data type',
c.max_length 'Max Length',
c.precision ,
c.scale ,
c.is_nullable
FROM sys.columns c
INNER JOIN sys.types t ON c.user_type_id = t.user_type_id
INNER JOIN sys.objects o ON c.object_id = o.object_id
WHERE o.type = 'U' AND o.Name LIKE 'JOB%'
ORDER BY o.Name ASC
-- Get columns and table names who table name start with 'JOB'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment