Hello, I have a few questions in regards to SQL Server. It was answered on the website before, but whenever I put it in my IDE I get a syntax error, so I will ask here instead for the few I need help with. The topic is MySQL triggers. The third question is as follows: "Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX."
Hello, I have a few questions in regards to SQL Server. It was answered on the website before, but whenever I put it in my IDE I get a syntax error, so I will ask here instead for the few I need help with. The topic is MySQL triggers.
The third question is as follows:
"Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX."
Note: The following stored procedure is used to create the stored procedure named prc_inv_amounts. Use proper variables and follow the syntax to avoid syntax errors.
Stored procedures:
- A procedure is a collection of procedural and Structured Query Language (SQL) statements.
- A procedure may have input parameter, output parameter and both parameters.
- It has a declared with a unique named with a unit of procedural code using the proprietary Relational Database Management System (RDBMS) and it is invoked by a host language library routine.
Syntax:
CREATE PROCEDURE procedure_name (parameters1 IN|OUT datatype_1, parameters2 IN|OUT datatype_2, parameters3 IN|OUT datatype_3, ......)
AS
BEGIN
SQL statements
END;
Step by step
Solved in 5 steps with 2 images