Create Proc TranTest
AS
BEGIN TRAN
INSERT INTO [authors]([au_id],
[au_lname],
[au_fname],
[phone],
[contract])
VALUES ('172-32-1176',
'Gates',
'Bill',
'800-BUY-MSFT',
1)
-- First Update query
UPDATE authors
SET au_fname = 'Johnzzz'
WHERE au_id = '172'
-- second Update query
UPDATE authors
SET au_fname = 'Johnzzz'
WHERE au_id = '175'
--third Update query
UPDATE authors
SET au_fname = 'Johnzzz'
WHERE au_id = '178'
COMMIT TRAN
GO
in the above i written three update statement, if suppose in the second update statment gets error, whether the first update statement record gets updated.
for that how to handle using transact sql
Loading
Ankit SharmaPosted Oct 6, 2017, 12:05 PM