Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

t-sql decimal symbol error

Posted on 2009-04-06
2
Medium Priority
?
405 Views
Last Modified: 2012-05-06
Hello Experts,
I have checked my regional settings and decimal seperator is (.)
But there are many records that consists decimal separator (,) in my database table. How can I format this rows as (.)
I mean when I try to run
select SUM(AccInvQty) from ItemDetails
then I get the wrong result. Because number format is wrong
Please help
0
Comment
Question by:innocent1973
2 Comments
 
LVL 22

Accepted Solution

by:
pivar earned 2000 total points
ID: 24075510
Hi,

Is AccInvQty a charfield? Then you could use select sum(cast(replace(AccInvQty,',','.') as decimal)) from ItemDetails. Otherwise can you show us your error?

/peter
0
 
LVL 12

Expert Comment

by:udaya kumar laligondla
ID: 24075691
1) solve the problem of . or , : you have to check your application that is generating the rows. if the application is using the system settings then if one of the systems is configured to use , then you will get this. if you are using .Net applicaiton to access the DB then use the culterinfo for hadling the . or , issues
2) correcting the existing data :
update ItemDetails set AccInvQty=replace(AccInvQty,',','.')
3)use the query given by pivar if you don;y want to correct the DB
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question