Tuesday, 27 February 2018

Microsoft SQL Output Statement

Microsoft SQL Output Statement

--Output statement displays the results of the insert, update, delete, merge, or stored procedure.
-- Output statement should display using scarlar result, single row result, or single column result.

--insert output statement follows

insert into [test].[dbo].[options ftse] (Product)
output inserted.*
values('01/03/18'),('01/04/18'),('01/05/18');

update [test].[dbo].[options ftse]
set Product='01/06/18'
output deleted.*
where product = '01/05/18';

delete from [test].[dbo].[options ftse]
output deleted.Product, deleted.Direction
where Product='01/03/18';

Inline image 1

No comments:

Post a Comment