I recently wanted to look into the possibility of using the insert-output construct and did some testing around it. I created two following procedures and executed them with IO, Time and profile ( SET STATISTICS IO, TIME , PROFILE ON ) 1.) One with the Insert-output construct CREATE PROCEDURE sp_WithOutputCluse @FirstName VARCHAR (30) ,@LastName VARCHAR (30) AS INSERT INTO HR.Staff ( FirstName, LastName ) OUTPUT INSERTED.StaffID, DATEADD (d,90, GETDATE ()), '90-Day Review' INTO HR.Notification ( StaffID, NotificationDate, NotificationType ) VALUES ( @FirstName,@LastName); 2.) One with the SET operation to accept the Scope_Identity() CREATE PROCEDURE sp_WithOut_OutputCluse @FirstName VARCHAR (30) ,@LastNam
This blog is to, share the encounters and learning’s of Sql Server