INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Decimal character "," or "."

Decimal character "," or "."

(OP)
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.

RE: Decimal character "," or "."

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: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints

RE: Decimal character "," or "."

(OP)
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.

RE: Decimal character "," or "."

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: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints

RE: Decimal character "," or "."

(OP)
johnwm and genomon,
thanks for the info.
:)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close