473,586 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting String To Decimal

benchpolo
142 New Member
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
4 20869
Delerna
1,134 Recognized Expert Top Contributor
convert(decimal (18,2),SUBAMOUN T)/100.0
Sep 30 '09 #2
benchpolo
142 New Member
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
gpl
152 New Member
Expand|Select|Wrap|Line Numbers
  1. convert(decimal(8,2),SUBAMOUNT)/100.0
Oct 19 '10 #4
NeoPa
32,566 Recognized Expert Moderator MVP
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

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

Similar topics

2
7663
by: Mariusz Sakowski | last post by:
I'm writing class which will be able to store large numbers (my ambition is to make it able to operand on thousands of bits) and perform various operations on it (similiar to those available with int type). I want to store the number as binary stream, and I don't know how to convert large decimal string (char*) to binary stream. Converting...
6
43163
by: LCD | last post by:
This a rather simple question for all you studs out there! Please help me with this. I have a string = "Please help me", and I want to convert this into it's hex equivalent. How do I do it, I have trying for a couple hours and can't seem to get my head straight arount this whole conversion things. TIA, LCD
4
5148
by: Spufi | last post by:
I have read several messages on converting packed decimals (EBCDIC) in a C++ program, but they were all for AS400 systems. I am looking for a way to convert the packed decimals in a COBOL program that is on a MVS (z/OS) system in a C++ program. Anyone have any idea how to do this? Is there a header or class that will do this?? Thanks in...
1
9965
by: mdawoodk | last post by:
i am getting error "input string was not in correct format" when converting a string decimal into integer value. code is like this: string strVal = ""; int nVal = 0; strVal = "14.9"; nVal += Convert.toInt32(strVal);
5
23458
by: SMichal | last post by:
Hi, how can I parse string "? 20.000" to double ?
2
4492
by: Tukeind | last post by:
Hello, I am receiving the following error: error C2065: 'to_binary' : undeclared identifier while running the code below. If anyone can help I'll appreciate it? Thank you, Tukeind
3
3843
by: Mike Howarth | last post by:
Hi Seem to be having a bit of brainfreeze this evening. Basically I'm reducing an array of prices like so: This gives me a string of '86.00.00' which I am trying to use with decimal objects. Python 2.4 is not particularly happy with this. Additionally I can't simply convert the string to a decimal as it would be
4
3448
by: Jeff | last post by:
Hey ..NET 2.0 In my code am I trying to convert an int value into a decimal: decimal d = 0; int k = 87664; d = Convert.ToDecimal(k/100);
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.