Skip to content

Instantly share code, notes, and snippets.

@vikaskanani
Last active April 12, 2016 07:29
Show Gist options
  • Save vikaskanani/69702cb5405165c574ab to your computer and use it in GitHub Desktop.
Save vikaskanani/69702cb5405165c574ab to your computer and use it in GitHub Desktop.
SELECT
tbl.name 'Table Name',
c.name 'Column Name',
t.Name 'Data type',
c.max_length 'Max Length',
c.precision,
c.is_nullable,
ISNULL(i.is_primary_key, 0) 'Primary Key'
FROM sys.columns c
INNER JOIN sys.types t ON c.user_type_id = t.user_type_id
INNER JOIN sys.tables tbl on tbl.object_id = c.object_id
LEFT JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id
LEFT JOIN sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id
WHERE 1=1
AND t.Name = 'numeric'
AND c.scale = 0
--AND (
-- c.name like '%bid%'
-- or
-- tbl.name like '%bid%'
--)
ORDER BY tbl.name
@vikaskanani
Copy link
Author

1866

@vikaskanani
Copy link
Author

1674

@vikaskanani
Copy link
Author

1565

@bharat20185
Copy link

1373

@bharat20185
Copy link

1363 :(

@bharat20185
Copy link

1133

@bharat20185
Copy link

Yuuuuu. 500

@bharat20185
Copy link

Closed a day having 301

@vikaskanani
Copy link
Author

190

@bharat20185
Copy link

Yuhuuuuuuuuuuu. Only 1 table left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment