Scenario:
Hoe zou u alle tabellen in een SQL Server-database met identiteitskolom vinden?Oplossing:
We kunnen systeemtabellen zoals sys.columns en sys.tables gebruiken om deze informatie te krijgen.--Find out all the columns for all the tables on which Identity Property is enabled SELECT DB_Name() AS DatabaseName ,OBJECT_NAME(c.OBJECT_ID) AS TableName ,c.NAME AS ColumnName FROM YourDBName.sys.columns c INNER JOIN sys.tables t ON c.object_id = t.object_id WHERE is_identity = 1

Videodemo:alle tabellen met identiteitskolom vinden in SQL Server