Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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