Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Decimal character "," or "."

Status
Not open for further replies.

JesperMP

Electrical
Aug 26, 2003
67
Hi.

Please bear with me, as I am a complete SQL noob.

Problem is this:
I have some VBScript code that writes values to SQL tables.
The code works OK, but I found out that for REAL values, the decimal character on the PC must be set to ".". If regional settings are set to german or danish for example, the decimal character becomes ",", and the writing of the REAL values to the database fails.
I have found out how to check which decimal character is the active one on the PC, so I generate a message if its "wrong" (i.e. "Decimal character must be set to '.' in Windows Regional Settings").

Questions:
Is the decimal character always "." in SQL ?
Is the separator character always "," in SQL ?
If they are configurable, how do you set them ?
If they are configurable, how do I programmatically determine which characters are active without changing them ?

THANKS for any help.

 
Replies continue below

Recommended for you

Why not just use the Replace function on your inputted values?
Code:
myNewStr = Replace(myOldStr,",",".")
That way Reals will work for either input style. You can use the reverse if you want to display as European on output

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
Steam Engine enthusiasts
Steam Engine Prints
 
Yes, I already do something similarly.

chDecPoint = Mid(CStr(8.1), 2, 1)
strVal1 = Replace(CStr(rVal1), chDecPoint, ".")
strVal2 = Replace(CStr(rVal2), chDecPoint, ".")
etc.

However, I need to know if the decimal character is ALWAYS "." in SQL.
Otherwise I may screw things up at another installation.

I have a feeling that the decimal and the separator are always "." and "," respectively.
But I would feel better if an SQL guru would confirm it for me.
 
You will need to check in the documentation for whichever flavour of SQL you are using. Most conform to ANSI SQL standards as far as decimal points are concerned - that is to say, it must be a . not a ,

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
Steam Engine enthusiasts
Steam Engine Prints
 
johnwm and genomon,
thanks for the info.
:)
 
genomon I admire your optimism! Compare MySQL syntax with MSSQL syntax to see substantial differences in actual implementation (eg TOP and LIMIT usage).

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
Steam Engine enthusiasts
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor