Auto_Identity column read in another table
I have a Table which has a column works asâauto_identityâ
I want to point to the last value of this column and then in another table read the value of that.
SQL1 = "insert into Table1 values (" + Lnum + ", 'REFER' , '" + Dt + "', '" + RunDt.ToString() + "', @@IDENTITY )";
conn.Execute(SQL1, out returnRecords, 0);
int i = 1;
foreach (string s in split)
{
SQL2 = "insert into Table2 values ('read the value of the identity column', " + i + ", '" + s + "')";
conn.Execute(SQL2, out returnRecords, 0);
++i;
}
would you help pls
thanks
My code is in C#.
|