Create table Tbl_output (id int identity(1,1), fname nvarchar(100), lname nvarchar(100))
Example of Output clause in case of Insert command
Declare @outputtemp Table (id int , fname nvarchar(100), lname nvarchar(100))
Insert into tbl_output(fname,lname)
Output inserted.id, inserted.fname, inserted.lname into @outputtemp
values(‘Vivek’, ‘Johari’)
Select * from @outputtemp
Example of Output clause in case of Update command
Update tbl_output set fname=’Vibodh’
Output inserted. fname , deleted.fname
where id=1
Example of Output clause in case of Delete command
Delete from tbl_output
Output deleted.*
where id=1
Discover more from Technology with Vivek Johari
Subscribe to get the latest posts sent to your email.






