By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,575 Members | 1,948 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,575 IT Pros & Developers. It's quick & easy.

Converting String To Decimal

benchpolo
100+
P: 142
I have a column SUBAMOUNT where the value is converted to text 0000008917'. When the file is received I need to convert it to decimal (0000008917 converted to 89.17. I tried to use the CAST TSQL command, but it is giving me a result of 8917.00, which is incorrect.

Thanks in advance for your assistance.
Sep 29 '09 #1
Share this Question
Share on Google+
4 Replies


Delerna
Expert 100+
P: 1,134
convert(decimal(18,2),SUBAMOUNT)/100.0
Sep 30 '09 #2

benchpolo
100+
P: 142
I'm getting an arithmetic overflow once I insert it to sql where the column data type is decimal (8,2).
Please advise.
Oct 19 '10 #3

100+
P: 152
gpl
Expand|Select|Wrap|Line Numbers
  1. convert(decimal(8,2),SUBAMOUNT)/100.0
Oct 19 '10 #4

NeoPa
Expert Mod 15k+
P: 31,538
Let's not waste time here.

Why don't you post the code you already use, that returns a value of 8917, then we can see how safely, in those particular circumstances, this value can be divided by 100.
Oct 20 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.