(Solution) ALTER PROC spTriangular @ValueIn int, @ValueOut int OUTPUT AS DECLARE @InWorking int; DECLARE @OutWorking int; IF @ValueIn > 32 BEGIN THROW... > Snapessays.com


(Solution) ALTER PROC spTriangular @ValueIn int, @ValueOut int OUTPUT AS DECLARE @InWorking int; DECLARE @OutWorking int; IF @ValueIn > 32 BEGIN THROW...


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

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

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)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 21, 2023

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP

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:

  • ■ As a reference for in-depth understanding of the subject.
  • ■ As a source of ideas / reasoning for your own research (if properly referenced)
  • ■ For editing and paraphrasing.

This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

Get Free Price Quote