From: Federico Caselli on 17 Jun 2010 11:47 Hi, I wrote a tsql statement to convert a money data into a varchar select convert(varchar,number,1) from table1 because I must send it through database mail. The result of the conversion is 20,340.00. Is there a way to get 20.340,00? Should I change the collation property of the db? Now it's set as Latin1_General_CI_AS. Thanks!
From: --CELKO-- on 17 Jun 2010 12:55 You should not be using the proprietary MONEY data type; look up the math errors in it. You should not be formatting display data in the database. This is fundamental. If this was a woodworking newsgroup and someone posted "What is the best kind of rocks to pound screws into fine furniture?" are you really helping them when you say "Granite! Use big hunks of granite!" I am the guy who replies with "Your question is bad. Don't you know about screwdrivers?" You got everything wrong and need to educate yourself.
From: Eric Isaacs on 17 Jun 2010 15:51 I think you might be better off changing the collation at the database level, as you suggest, but you would need to test this. Which collation do you need exactly? If this is just a one-time need and you don't want to change the collation, you could swap the commas and decimal points with a replace clause. select replace(replace(replace(convert(varchar(25),number,1), '##', '.'), ',', '."), '##', ',') from table1 -Eric Isaacs
|
Pages: 1 Prev: Check if a row is empty Next: Removing duplicates in multiple tables |