FORZARE VALORI ID IN SQL

Forzando l’inserimento di un campo ID si riceve l’errore:
Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF
Per ovviare a ciò, basta eseguire:
SET IDENTITY_INSERT Table1 ON
INSERT INTO Table1 .....
SET IDENTITY_INSERT Table1 OFF
Category: SQL

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *