Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert European numeric format to US

Status
Not open for further replies.

ProdAir

MIS
Jan 11, 2005
50
US
Is there a function to convert a number that's European (4.100,00 - dots in place of comma for thousands and comma for decimal point) into US (4,100.00)? I could do replace but that could cause problems and performance issues...
 
This "number" - how is it stored? As char/varchar?

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
varchar. I believe the problem lies in the fact the data source are spreadsheets which come from Europe which are then converted into text files. I see no point in converting the data back into spreadsheet format only to re-format the numbers. I haven't found anything on the CONVERT function so I was wondering if there's a better way of doing this other than REPLACE. Thanks!
 
Umm, this may be a dumb question, but why are numbers being stored in a character column?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Because the conversion to text converts them into characters. Also, this ensures the precision and scale of the numbers are preserved. When importing data from anywhere, it's almost always safest to import everything as characters because you can do your validation against it in a staging area and then make the necessary data type conversion into your production tables.
 
Oh, and there are no dumb questions. Thanks for the responses guys.
 
AFAIK conversion from string to number always assumes dot (.) for decimal separator and optional comma (,) as thousands separator for money. This is is not affected by collation, SET LANGUAGE, any of CONVERT styles or currency prefixes (€, £, ¥...)

For one-time conversion, REPLACE() won't hurt much.

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top