Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Regional settings - decimal separator

 
   Database Help (Home) -> Programming RSS
Next:  Stored Procedure OUTPUT problem  
Author Message
Kristoffer Persson

External


Since: May 05, 2004
Posts: 7



(Msg. 1) Posted: Wed Feb 16, 2005 4:40 pm
Post subject: Regional settings - decimal separator
Archived from groups: microsoft>public>sqlserver>programming (more info?)

Hi!

I would like to know which decimal separator is used on a computer, from a
stored procedure.

My stored procedure will insert a decimal value into a string, that must be
formatted in a special way, and insert the string in a table. The problem is
that decimal values in the string MUST HAVE the regional decimal separator
in order to work on the other end.

Something like CONVERT(VARCHAR(20), 123.456, USE_REGIONAL_DEC_SEPARATOR)
would be nice.

So, is it possible? If I need to use REPLACE(), then I need to know what to
replace the dot with...

- Kristoffer -

 >> Stay informed about: Regional settings - decimal separator 
Back to top
Login to vote
David Portas

External


Since: Nov 11, 2003
Posts: 854



(Msg. 2) Posted: Wed Feb 16, 2005 4:40 pm
Post subject: Re: Regional settings - decimal separator [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Format it client-side. Why would you store numeric formatting in a
table? What would you do if two client PCs had different regional
settings?

--
David Portas
SQL Server MVP
--

 >> Stay informed about: Regional settings - decimal separator 
Back to top
Login to vote
Jacco Schalkwijk1

External


Since: Jun 02, 2004
Posts: 30



(Msg. 3) Posted: Wed Feb 16, 2005 4:40 pm
Post subject: Re: Regional settings - decimal separator [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You can get the decimal separator for the _user_ SQL Server is running under
from the registry. The key is HKEY_CURRENT_USER\Control
Panel\International\sDecimal, and you can read that key with the
undocumented extended procedure xp_reg_read. See
<a rel="nofollow" style='text-decoration: none;' href="http://www.mssqlcity.com/Articles/Undoc/UndocExtSP.htm" target="_blank">http://www.mssqlcity.com/Articles/Undoc/UndocExtSP.htm</a>

for a bit of unofficial documentation.

--
Jacco Schalkwijk
SQL Server MVP


"Kristoffer Persson" <hidden> wrote in message

 > Hi!
 >
 > I would like to know which decimal separator is used on a computer, from a
 > stored procedure.
 >
 > My stored procedure will insert a decimal value into a string, that must
 > be
 > formatted in a special way, and insert the string in a table. The problem
 > is
 > that decimal values in the string MUST HAVE the regional decimal separator
 > in order to work on the other end.
 >
 > Something like CONVERT(VARCHAR(20), 123.456, USE_REGIONAL_DEC_SEPARATOR)
 > would be nice.
 >
 > So, is it possible? If I need to use REPLACE(), then I need to know what
 > to
 > replace the dot with...
 >
 > - Kristoffer -
 >
 >
 >> Stay informed about: Regional settings - decimal separator 
Back to top
Login to vote
Tibor Karaszi

External


Since: Jan 29, 2004
Posts: 1559



(Msg. 4) Posted: Wed Feb 16, 2005 4:40 pm
Post subject: Re: Regional settings - decimal separator [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

SQL Server has no knowledge of the Windows setting that the client machine has which is connected
through a connection. I.e., asking for what decimal setting a connection's windows machine have is
impossible. You need to provide that information though the client application somehow.

--
Tibor Karaszi, SQL Server MVP
<a rel="nofollow" style='text-decoration: none;' href="http://www.karaszi.com/sqlserver/default.asp" target="_blank">http://www.karaszi.com/sqlserver/default.asp</a>
<a rel="nofollow" style='text-decoration: none;' href="http://www.solidqualitylearning.com/" target="_blank">http://www.solidqualitylearning.com/</a>
<a rel="nofollow" style='text-decoration: none;' href="http://www.sqlug.se/" target="_blank">http://www.sqlug.se/</a>


"Kristoffer Persson" <hidden> wrote in message
 > Hi!
 >
 > I would like to know which decimal separator is used on a computer, from a
 > stored procedure.
 >
 > My stored procedure will insert a decimal value into a string, that must be
 > formatted in a special way, and insert the string in a table. The problem is
 > that decimal values in the string MUST HAVE the regional decimal separator
 > in order to work on the other end.
 >
 > Something like CONVERT(VARCHAR(20), 123.456, USE_REGIONAL_DEC_SEPARATOR)
 > would be nice.
 >
 > So, is it possible? If I need to use REPLACE(), then I need to know what to
 > replace the dot with...
 >
 > - Kristoffer -
 >
 >
 >> Stay informed about: Regional settings - decimal separator 
Back to top
Login to vote
Kristoffer Persson

External


Since: May 05, 2004
Posts: 7



(Msg. 5) Posted: Thu Feb 17, 2005 3:40 am
Post subject: Re: Regional settings - decimal separator [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"David Portas" wrote in message

 > Why would you store numeric formatting in a table?

I agree, but the only interface I have is to store a string formatted
according to the regional settings on the computer reading this information.

 > What would you do if two client PCs had different regional settings?

That wouldn't be very good, but I can assume that all PC's within the
network have the same regional settings.

Thanks for your input!

- Kristoffer -
 >> Stay informed about: Regional settings - decimal separator 
Back to top
Login to vote
Kristoffer Persson

External


Since: May 05, 2004
Posts: 7



(Msg. 6) Posted: Thu Feb 17, 2005 3:40 am
Post subject: Re: Regional settings - decimal separator [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks! I guess this is the path I'll have to walk.

- Kristoffer -

"Jacco Schalkwijk" wrote
in message
 > You can get the decimal separator for the _user_ SQL Server is running
under
 > from the registry. The key is HKEY_CURRENT_USER\Control
 > Panel\International\sDecimal, and you can read that key with the
 > undocumented extended procedure xp_reg_read. See
<font color=purple> > <a rel="nofollow" style='text-decoration: none;' href="http://www.mssqlcity.com/Articles/Undoc/UndocExtSP.htm</font" target="_blank">http://www.mssqlcity.com/Articles/Undoc/UndocExtSP.htm</font</a>>
 >
 > for a bit of unofficial documentation.
 >
 > --
 > Jacco Schalkwijk
 > SQL Server MVP
 >> Stay informed about: Regional settings - decimal separator 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
.net native SqlClient regional settings problem - Hello. I am using the native SqlClient from the 1.1 .net-framework to connect to Sqlserver 2000. The database-connection is programmed in Visual Studio 2003 in C#. The database-connection is stable for a while, but after 10-20 days my connection isn't....

format number with thousand-separator - is there a built in function in sql server 2005 that will format a number with commas as the thousand-separator? ie., here's what i want to do: input=1000 output=1,000 or input=1000000 output=1,000,000 if there isn't a built-in function, can someone....

Decimal Comma vs Decimal Point - Hello, I want to insert a Single/Float type value into a table using the following SQL statement. I'm executing this from a VB6 app using ADO 2.7. myValue = "0.5074655" (Entered by the user into a textbox) strSQL = "INSERT INTO myTable ...

Properties settings for MSDAORA - Environment: MS SQL SERVER 2005 I have trouble getting the linked server to Oracle to work on this machine running SQL server 2005 Express. I keep getting an error message 7399 My setup works on the production server (runs MS SQL SERVER 2005 standard)...

Saving Object Explorer Settings in SSMS - Hi, When I use management studio I have four database servers present in the object explorer pane. However each time I close SSMS and then re-open it again the servers are no longer there. They are retained in the registered servers pane and each time ...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]