Solved

t-sql decimal symbol error

Posted on 2009-04-06
2
392 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 500 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:udayakumarlm
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server Set bit value based on sums 4 47
SQL Server 2000: == Linked Server, With higher version == 16 103
SQL Server Remove all trailing commas 10 70
Need help with a query 3 44
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…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

947 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now