07 February,2023 by Tom Collins
Question: How to find all identity columns in SQL Server?
Answer:
USE myDB; SELECT SCHEMA_NAME(o.schema_id) AS [schema], OBJECT_NAME(idc.object_id) AS [object], o.type_desc, idc.name, idc.seed_value, idc.increment_value, idc.last_value FROM sys.identity_columns idc INNER JOIN sys.objects o ON o.object_id = idc.object_id ORDER BY SCHEMA_NAME(o.schema_id) ASC;
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |