Situatie
Mai jos este o procedura ce listeaza toate tabelele de pe o baza de date Microsoft SQL Server ce contin coloane – definit IDENTITY.
Solutie
create procedure FindTableWithIdentityColumns
as
SELECT [Table] = s.[Name] + N’.’ + t.[Name]
FROM [sys].tables t
JOIN [sys].schemas s ON t.[schema_id] = s.[schema_id]
WHERE EXISTS
(
SELECT * FROM [sys].identity_columns i
WHERE i.[object_id] = t.[object_id]
);
Leave A Comment?