I need help with these questions and am using SQL with the adventurework2012 database.1. Reimplement the spTriangular function from Chapter 12 as a function instead of as a stored procedure. (Query is attached)2. Create a function that takes as inputs a SalesOrderID, a CurrencyCode, and a date, and returnsa table of all the SalesOrderDetail rows for that Sales Order including Quantity, ProductID,UnitPrice, and the unit price converted to the target currency based on the end of day rate forthe date provided. Exchange rates can be found in the Sales.CurrencyRate tableALTER PROC spTriangular
@ValueIn int,
@ValueOut int OUTPUT
AS
DECLARE @InWorking int;
DECLARE @OutWorking int;
IF
@ValueIn > 32
BEGIN
THROW 50001, 'Overflow! Input value should not be greater than 32', 1;
RETURN;
END
IF @ValueIn != 1
BEGIN
SELECT @InWorking = @ValueIn - 1;
EXEC spTriangular @InWorking, @OutWorking OUTPUT;
SELECT @ValueOut = @ValueIn + @OutWorking;
END
ELSE
BEGIN
SELECT @ValueOut = 1;
END
RETURN;
GO
This question was answered on: Sep 21, 2023
Solution~00021147635954.zip (25.37 KB)
This attachment is locked
Our expert Writers have done this assignment before, you can reorder for a fresh, original and plagiarism-free copy and it will be redone much faster (Deadline assured. Flexible pricing. TurnItIn Report provided)
Answered
QUALITYApproved
DATE ANSWEREDSep 21, 2023
EXPERTTutor
ANSWER RATING
We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.
You can also use these solutions: