Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
Administration
»
float to decimal
float to decimal
Rate Topic
Display Mode
Topic Options
Author
Message
Wadingman
Wadingman
Posted Monday, January 28, 2013 11:55 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, May 09, 2013 3:09 PM
Points: 8,
Visits: 136
Hi I have SQL Server 2000 - 8.00.2066 (Intel X86)
Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 3)
with a Java Application (1.5)
I have a sqlserver.jdbc.SQLServerException:
Error converting data type float to decimal from a stored procedure.
So, I needed to increase the max size in the column, so I increased the column from 8,2 to 9,2 with a
ALTER COLUMN [total_m] [decimal](9, 2) NOT NULL
That works, now with SQL, I can insert a value of 1,000,000.00 into this column. doubleValue() should hold the million.
When the application runs, it uses a stored procedure to insert the data
HOWEVER the save FAILS with the
Error converting data type float to decimal from a stored procedure.
Here is the basics of the stored procedure :
(I scaled this down to the relevant info:)
qq_SQL = "{? = call usp_temp_ins(? )}";
qq_call = this.getTheDBSession().getCallableStatement(qq_SQL);
qq_call.registerOutParameter(1, Types.INTEGER);
--// handle return codes
qq_call.registerOutParameter(2, java.sql.Types.INTEGER);
qq_call.registerOutParameter(3, java.sql.Types.INTEGER);
qq_call.registerOutParameter(4, java.sql.Types.INTEGER);
--
if (((Temp)p_Tempp.getObject()).getTotal_m() == null)
qq_call.setNull(1, Types.DOUBLE);
else
qq_call.setDouble(1, ((Temp)p_Temp.getObject()).getTotal_m().doubleValue());
qq_call.execute();
((Temp)p_Temp.getObject()).setM_id(qq_call.getInt(2));
row_count = qq_call.getInt(3);
ret_code = qq_call.getInt(4);
qq_RowCount = (DataValue)FrameworkUtils.mapToDataValue(qq_call.getObject(1));
}
Any suggestions very much appreciated.
Post #1412589
MyDoggieJessie
MyDoggieJessie
Posted Monday, January 28, 2013 1:19 PM
SSCrazy
Group: General Forum Members
Last Login: Friday, May 17, 2013 8:50 AM
Points: 2,037,
Visits: 3,759
Seems to be more of an issue with the precision you are setting with your decimal data type i.e. (9,2) - determine the maximum number of decimal places in the float column, then increase the precision to match that number
______________________________________________________________________________
"Never argue with an idiot; They'll drag you down to their level and beat you with experience"
Post #1412624
Wadingman
Wadingman
Posted Wednesday, January 30, 2013 12:09 PM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, May 09, 2013 3:09 PM
Points: 8,
Visits: 136
It turns out I was looked at the wrong stored procedure
After I altered the correct stored procedure to match the table alter it worked fine.
Thanks for the help !
Post #1413737
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.