Skip to content

Instantly share code, notes, and snippets.

@jujiro
Created May 20, 2019 17:18
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 jujiro/383dff3935ceed6bada5479202d3d659 to your computer and use it in GitHub Desktop.
Save jujiro/383dff3935ceed6bada5479202d3d659 to your computer and use it in GitHub Desktop.
Find identity columns (Sql server)
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