Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Develop and save the stored procedure usp_Insert_Customer to insert one customer

ID: 3699045 • Letter: D

Question

Develop and save the stored procedure usp_Insert_Customer to insert one customer record into the customer table in the Order Entry Database

? Develop and save the trigger tr_Invalid_Balance to check if the new customer record which is being inserted includes a non-zero balance. If so, this insertion will be denied (Rollback).

@CustNo char(8),

@CustFirstName varchar(20),

@CustLastName varchar(20),

@CustStreet varchar(50),

@CustCity varchar(30),

@CustState char(2),

@CustZip char (2),

@CustBal decimal(12,2)

Explanation / Answer

CREATE TRIGGER tr_Invalid_Balance ON dbo.Customer AFTER INSERT AS
BEGIN
IF EXISTS ( SELECT * FROM dbo.Customer WHERE CustBal < 0 )
BEGIN
ROLLBACK TRANSACTION
RAISERROR ('Error! Non-zero balance cannot be inserted', 16, 1)
END
END

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote