Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using SQL Server. Myguitarshop database. 1.Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table.

using SQL Server. Myguitarshop database.

1.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/arguments. One parameter/argument for each of these columns: CategoryID (int), ProductCode (varchar), ProductName (varchar), ListPrice (smallmoney), and DiscountPercent (decimal). In the procedure, validate the following: If the value for the ListPrice column is a negative number, the stored procedure should throw an error (using THROW) that indicates that this column doesnt accept negative numbers. If the value for the DiscountPercent column is a negative number, the stored procedure should also throw a similar error (using THROW). When inserting data into the Products table, set the Description column to an empty string and set the DateAdded column to the current date.

2. Code at least two EXEC statements that test this procedure (one successful, one failure)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago