CREATE PROC spInsertProduct

Jun 17th, 2015
Studypool Tutor
Newman University
Course: general
Price: $20 USD

Tutor description

Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table.

Word Count: 475
Showing Page: 1/4
Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table. This stored procedure should accept five parameters. One parameter for each of these columns: CategoryID, ProductCode, ProductName, ListPrice, and DiscountPercent.If the value for the ListPrice column is a negative number, the stored procedure should raise an error that indicates that this column doesn't accept negative numbers. Similarly, the procedure should raise an error if the value for the DiscountPercent column is a negative number.When inserting data into the Products table, set the Description column to an empty string and set the DateAdded column to the current date.Code at least two EXEC statements that test this procedure (one successful, one failure) IF Object_ID('spInsertProduct') IS NOT NULLDROP PROC spInsertProductGOCREATE PROC spInsertProduct(@CategoryID INT,@ProductCode varchar(10),@ProductName varchar(255),@ListPrice money,@DiscountPercent money)ASIF @ListPrice < 0 THROW 50001, 'List Price cannot be negative.',1;IF @DiscountPercent < 0 THROW 50002,'Discount Percent cannot be negative.',1;INSERT INTO Products(CategoryID

Review from student

Studypool Student
" all I can say is wow very fast work, great work thanks "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors