Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Decimal separator in managment studio

4,879 views
Skip to first unread message

simon

unread,
Nov 22, 2010, 4:30:17 AM11/22/10
to
In SQL 2008 server managment studio I have reults of my query shown in
grid.
The decimal numbers are shown with decimal point, like this: 10.05
I would like to set that decimal separator is comma, not point, like
this: 10,05
How can I do that? Because in my language the points are thousand
separators and comas are decimal separators.

Best regards,
Simon

Erland Sommarskog

unread,
Nov 22, 2010, 4:36:09 PM11/22/10
to
I don't think this is possible. Query Analyzer in SQL 2000 had a setting
where you could opt for regional settings to be honoured. (Which I never
used.)

What is funny, is the consistency. Try this:

select convert(float, 10.12), convert(decimal(5, 2), 10.12)


--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Ooogy

unread,
Nov 22, 2010, 4:41:26 PM11/22/10
to
Simon - I suppose one could accomplish this relatively easily but
converting the number to VARCHAR or NVARCHAR then doing a REPLACE with
the decimal to a comma. I'm pretty sure you would mess up any sorting/
ordering you wanted to do with it though at that point.

The *real* answer to be honest is to store the data in it's native
format and then do any conversion necessary at the client. You won't
run in to any issues w/ sorting or precision that way.

Good luck...Troy

Bob Barrows

unread,
Nov 22, 2010, 4:58:24 PM11/22/10
to

Errr ... Management Studio IS the client in this case, and it appears
the OP is out of luck.
Is there a Connect entry on this issue? There should be.
--
HTH,
Bob Barrows


Gene Wirchenko

unread,
Nov 22, 2010, 6:40:00 PM11/22/10
to
On Mon, 22 Nov 2010 22:36:09 +0100, Erland Sommarskog
<esq...@sommarskog.se> wrote:

>simon (zupa...@gmail.com) writes:
>> In SQL 2008 server managment studio I have reults of my query shown in
>> grid.
>> The decimal numbers are shown with decimal point, like this: 10.05
>> I would like to set that decimal separator is comma, not point, like
>> this: 10,05
>> How can I do that? Because in my language the points are thousand
>> separators and comas are decimal separators.
>
>I don't think this is possible. Query Analyzer in SQL 2000 had a setting
>where you could opt for regional settings to be honoured. (Which I never
>used.)

I thought I would have go at this. I changed my region to French
(French), started SSMS, and did a simple query of select 1.7+2.5. The
result was 4.2 not 4,2. I even tried rebooting in case the effect was
delayed. No go.

I am running Windows XP Home and SSE 2008.

>What is funny, is the consistency. Try this:
>
>select convert(float, 10.12), convert(decimal(5, 2), 10.12)

Why is this odd? It is what I would expect.

Sincerely,

Gene Wirchenko

Hugo Kornelis

unread,
Nov 22, 2010, 6:47:02 PM11/22/10
to
On Mon, 22 Nov 2010 01:30:17 -0800 (PST), simon <zupa...@gmail.com>
wrote:

Hi Simon,

I realise it's not exactly the answer you are looking for, but if I
ast the values to float, AND choose output to text rather than output
to grid, I do get a decimal comma.
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

simon

unread,
Nov 23, 2010, 10:52:55 AM11/23/10
to
On 23 nov., 00:47, Hugo Kornelis
<h...@perFact.REMOVETHIS.info.INVALID> wrote:
> On Mon, 22 Nov 2010 01:30:17 -0800 (PST), simon <zupan....@gmail.com>

Hi,

thank you all for your answer. Obviouslly, there is no solution.
I changed the language of connected user to Slovenian and still the
same.
In database I have decimal number type.
If I select it and cast it into float than I get decimal comma, also
works if in database is float column.

But I have decimal data types in my database and I won't want always
cast all decimal columns into float because of comma.

regards,
Simon


Erland Sommarskog

unread,
Nov 23, 2010, 4:58:42 PM11/23/10
to
Gene Wirchenko (ge...@ocis.net) writes:
>>select convert(float, 10.12), convert(decimal(5, 2), 10.12)
>
> Why is this odd? It is what I would expect.
>

I don't know what you see, but I see this:

10,12 10.12

I don't know why I should expect this, but I don't.

Although, I believe the difference is due to different implementations
for .ToString() for the corresponding data types in .Net; I think I've
seen similar inconsistences with C# code.

I did report this during the Yukon beta, but the bug report was promptly
closed, and I found more important battles to fight.

Gene Wirchenko

unread,
Nov 23, 2010, 7:01:17 PM11/23/10
to
On Tue, 23 Nov 2010 22:58:42 +0100, Erland Sommarskog
<esq...@sommarskog.se> wrote:

>Gene Wirchenko (ge...@ocis.net) writes:
>>>select convert(float, 10.12), convert(decimal(5, 2), 10.12)
>>
>> Why is this odd? It is what I would expect.

>I don't know what you see, but I see this:
>
> 10,12 10.12

I see "10.12" and "10.12". I checked this yesterday. I checked
it again just now. Commas need not apply.

>I don't know why I should expect this, but I don't.

I have figured it out somewhat. I run with the English (Canada)
region settings slightly modified (but not for numbers). I switched
to French (France), started SSMS, and tried the query. I then saw
what you saw.

>Although, I believe the difference is due to different implementations
>for .ToString() for the corresponding data types in .Net; I think I've
>seen similar inconsistences with C# code.
>
>I did report this during the Yukon beta, but the bug report was promptly
>closed, and I found more important battles to fight.

It appears that displaying a number is done with decimal points
regardless of region, but converting to a string respects the region.

I did not see if SSMS would pick up such a setting change or just
goes with what was in effect when it started, and I did not try
anything else similar.

Sincerely,

Gene Wirchenko

0 new messages