DebbieChapman
Programmer
Can anyone help on this stored procedure, The Proceedure works fine except that it rounds my charge ie if the charge is 3.5 it displays 4, I've tried to conver the @charge to money, but when I do this i get an error which says
Err 257: Implicit Conversion from datatype money to nvarchar is not allowed, Use the CONVERT function to run this query.
CREATE PROCEDURE BS_CustomerBundleAllowances
@CustomerID Char(6),
@Charge int = 0 OUTPUT,
@Mins int = 0 OUTPUT,
@IntMins int = 0 OUTPUT
AS
SET NOCOUNT ON
Begin
Select CustomerID, BoltOnRef, Allowance, Charge, Mins, IntMins into #Allowance
from BS_BundleAllowances
WHERE CustomerID = @CustomerID
End
Begin
UPDATE #allowance
SET Allowance = 0
WHERE (Allowance < 1)
End
Begin
UPDATE #Allowance
SET
Charge = tblBoltOns.Charge,
Mins = tblBoltOns.Mins,
IntMins = tblBoltOns.Int_Mins
From tblBoltOns, #Allowance
WHERE (tblBoltOns.BoltOnRef = #Allowance.BoltOnRef) and (#Allowance.Allowance = 0)
End
SET @Charge = (Select Charge from #Allowance)
SET @Mins = (Select Mins from #Allowance)*60
SET @IntMins = (Select IntMins from #Allowance)*60
Print @Charge
Print @Mins
Print @IntMins
-- View Allowances for each customer
Select * from #Allowance
Err 257: Implicit Conversion from datatype money to nvarchar is not allowed, Use the CONVERT function to run this query.
CREATE PROCEDURE BS_CustomerBundleAllowances
@CustomerID Char(6),
@Charge int = 0 OUTPUT,
@Mins int = 0 OUTPUT,
@IntMins int = 0 OUTPUT
AS
SET NOCOUNT ON
Begin
Select CustomerID, BoltOnRef, Allowance, Charge, Mins, IntMins into #Allowance
from BS_BundleAllowances
WHERE CustomerID = @CustomerID
End
Begin
UPDATE #allowance
SET Allowance = 0
WHERE (Allowance < 1)
End
Begin
UPDATE #Allowance
SET
Charge = tblBoltOns.Charge,
Mins = tblBoltOns.Mins,
IntMins = tblBoltOns.Int_Mins
From tblBoltOns, #Allowance
WHERE (tblBoltOns.BoltOnRef = #Allowance.BoltOnRef) and (#Allowance.Allowance = 0)
End
SET @Charge = (Select Charge from #Allowance)
SET @Mins = (Select Mins from #Allowance)*60
SET @IntMins = (Select IntMins from #Allowance)*60
Print @Charge
Print @Mins
Print @IntMins
-- View Allowances for each customer
Select * from #Allowance