TSQL: Consider SCOPE_IDENTITY() instead of @@IDENTITY

Problem I have two tables with ID column that has IDENTITY property. A trigger on Table1, if I insert data into Table1, the trigger will be fired up to insert data into Table2 Use Demo; GO CREATE TABLE Table1(ID int IDENTITY, value varchar(1)) CREATE TABLE Table2(ID int IDENTITY, value varchar(1)) GO CREATE TRIGGER trg_InsertIntoTable2 ON … Continue reading TSQL: Consider SCOPE_IDENTITY() instead of @@IDENTITY

Advertisements