Thema: Delphi set identity_insert

Einzelnen Beitrag anzeigen

Benutzerbild von Marcel Gascoyne
Marcel Gascoyne

Registriert seit: 18. Nov 2003
Ort: Uetersen
271 Beiträge
 
Delphi 2005 Architect
 
#3

Re: set identity_insert

  Alt 12. Dez 2003, 07:17
Du kannst SET IDENTITY_INSERT immer nur auf eine Tabelle zur Zeit anwenden. Steht auch so in der Doku:

Zitat:
SET IDENTITY_INSERT
Allows explicit values to be inserted into the identity column of a table.

Syntax
SET IDENTITY_INSERT [ database. [ owner. ] ] { table } { ON | OFF }

Arguments
database

Is the name of the database in which the specified table resides.

owner

Is the name of the table owner.

table

Is the name of a table with an identity column.

Remarks
At any time, only one table in a session can have the IDENTITY_INSERT property set to ON. If a table already has this property set to ON, and a SET IDENTITY_INSERT ON statement is issued for another table, Microsoft® SQL Server™ returns an error message that states SET IDENTITY_INSERT is already ON and reports the table it is set ON for.

If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value.

The setting of SET IDENTITY_INSERT is set at execute or run time and not at parse time.
Ich würde mal versuchen die Daten zuerst in eine temporäre Tabelle zu importieren und dort die Werte, z.b. über eine Stored Procedure, zu Ändern. Danach schreibst Du alles in die echten Tabellen rein.

Gruß,
Marcel
Marcel Gascoyne
  Mit Zitat antworten Zitat