Created
May 20, 2019 17:18
-
-
Save jujiro/383dff3935ceed6bada5479202d3d659 to your computer and use it in GitHub Desktop.
Find identity columns (Sql server)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
i.table_catalog, | |
i.table_schema, | |
i.table_name, | |
c.name as column_name | |
from | |
( | |
sys.objects o inner join | |
sys.columns c | |
on | |
o.object_id = c.object_id) inner join | |
information_schema.tables i | |
on | |
object_id('['+table_catalog+'].['+table_schema+'].['+table_name+']')=o.object_id | |
where | |
c.is_identity = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment