Solved

t-sql decimal symbol error

Posted on 2009-04-06
2
395 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Select * from 6 41
How to disable/enable multiple sql jobs in efficient way 11 108
Caste datetime 2 57
Help with SQL - TOP 10 by date and by group 13 40
This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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