Link to home
Start Free TrialLog in
Avatar of matrix_aash
matrix_aashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Stored Procedure Decimal

Hi,

I have a tabled that holds values of money and so in my stored procedure i need the datatype to be decimal for something such as £10.50. In the stored procedure the datatype for the output is decimal. When i displayed the output it said 100 when it was meant to be 99.50 (or 99.5) and so in my ASP code i have put :

rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourcecmdon", 14, 2, -1, "0")

I then got an error saying: "The precision is invalid.". I added "rsReport_cmd.Parameters("sourcecmdon").NumericScale = 2" and "rsReport_cmd.Parameters("sourcecmdon").Precision = 10" which supressed the error but i'm still getting 100 and not 99.5.

Any ideas?
Avatar of kevp75
kevp75
Flag of United States of America image

set p = eqCmd.CreateParameter(, 14, , 9, strData)
p.numericScale = 2
p.Precision = 10
eqCmd.Parameters.Append p


eqCmd = your command object
strData = the data you want to input
Avatar of matrix_aash

ASKER

How would i implament that to this?
<%
Dim rsReport
Dim rsReport_cmd
Dim rsReport_numRows
 
Set rsReport_cmd = Server.CreateObject ("ADODB.Command")
rsReport_cmd.ActiveConnection = MM_connCCO_STRING
rsReport_cmd.CommandText = "{call dbo.MEP_Reporting(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}" 
rsReport_cmd.Prepared = true
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("dateenable", 5, 1, -1, setDateEnable)
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("datestart", 133, 1, -1, setDateStart)
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("region86", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("region87", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("region88", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("region86don", 14, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("region87don", 14, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("region88don", 14, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourcere", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourcencco", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourcecm", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourceredon", 14, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourcenccodon", 14, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("sourcecmdon", 14, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("addrchange", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("totaldon", 5, 2, -1, "0")
rsReport_cmd.Parameters.Append rsReport_cmd.CreateParameter("valuedon", 14, 2, -1, "0")
 
Set rsReport = rsReport_cmd.Execute
rsReport_numRows = 0
%>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of matrix_aash
matrix_aash
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i will try to get to this tonight...at work in my day job right now...