Have Table with Non Identity Primary key. so whenever we insert new record we have to pass Primary key also.
I have to insert into the above table when record is not matched using Merge statement. But the problem is i could not increment the Primary key for each insert. it it throwing can not insert duplicate in Primary key column. Please find the Sample Merge query below.
Is it possible to insert multiple rows by increment primary key.
MERGE DBO.Table1 T1
USING (DBO.Table2 )T2
ON (T1.ID = T2.ID)
WHEN MATCHED
THEN UPDATE SET
T1.CURVE = T2.CURVE
WHEN NOT MATCHED
THEN INSERT (ID, CURVE )
Values ( T2.ID, T2.CURVE);