IDENTITY_INSERT
Posted: Tue 28 Aug 2012 15:06
Hello,
Is there any option that allow me to set identity column value this way:
Where:
Id - identity column
Name - additional fields.
I want to use FieldByName and TUniQuery to add record with identity specified.
I get error that Identity_insert is not set for table e.g test.
Is there any option that allow me to set identity column value this way:
Code: Select all
var
FQuery: TUniQuery
begin
FQuery := TUniQuery.Create(Self);
FQuery.SQL.Add('SELECT * FROM MyTable WHERE 1=0');
FQuery.Connection = ...;
FQuery.Open;
FQuery.Append;
FQuery.FieldByName('Id').ReadOnly := False;
FQuery.FieldByName('Id').Value = 10;
FQuery.FieldByName('Name').Value = 'AAAAAA';
FQuery.Post;
Id - identity column
Name - additional fields.
I want to use FieldByName and TUniQuery to add record with identity specified.
I get error that Identity_insert is not set for table e.g test.