0% found this document useful (0 votes)
27 views1 page

Assignment 6a

Uploaded by

rohit rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Assignment 6a

Uploaded by

rohit rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

‘customer_san_jose’ which

-- 2.
(007, 'Alex', 'Jordan','[email protected]', '3828 Piermont Dr',
'Albuquerque', 'New Mexico', 115599);

BEGIN TRANSACTION
UPDATE Customer
SET First_Name = 'Francis'
WHERE Last_Name = 'Jordan'

ROLLBACK TRANSACTION

BEGIN TRANSACTION
UPDATE Customer
SET First_Name = 'Alex'
WHERE Last_Name = 'Jordan'

-- 3. Inside a TRY... CATCH block, divide 100 with 0, print the default error
message.

BEGIN TRY
BEGIN TRANSACTION
UPDATE Cust_Order
SET Amount = 100/0
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
PRINT 'Amount cannot be devided by Zero'
END CATCH

-- 4. Create a transaction to insert a new record to Orders table and save it.

BEGIN TRY
BEGIN TRANSACTION
INSERT INTO Cust_Order (O_Id, O_Date, Amount, C_Id) VALUES
(106, '2023-08-23', 4175, 6)
SAVE TRANSACTION SIXTH_ENTRY
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
PRINT 'Cannot ENTER the values'
END CATCH

You might also like