Gasire tabele fara identity column

Configurare noua (How To)

Situatie

Mai jos este o procedura ce aduce toate tabelele fara identity column de pe o baza de date MSSQL Server.

Solutie

create procedure ListTablesWithoutIdentity
as
SELECT
[Table] = s.[Name] + N’.’ + t.[Name]
  FROM [sys].tables t
  JOIN [sys].schemas  s ON t.[schema_id] = s.[schema_id]
  WHERE not EXISTS
  (
      SELECT top 1 1  FROM [sys].identity_columns i
      WHERE i.[object_id] = t.[object_id]
  );

Tip solutie

Permanent
Etichetare:

Voteaza

(1 din 9 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?