views:

165

answers:

3

What do I need to change in Sql Server to be able to store values like "2,1" in a decimal field? Right now I have to have dots like "2.1".

I have Finnish_Swedish_CI_AS collation on the database but that doesn't seem to be it ... I also fiddled around with the regions settings on the server but with no success. I know I've managed to change this before.

+3  A: 

In security, your login properties, set default language to Finnish or Swedish. Although I'd prefer to format values into english standard and have default language set to english - this way storing data is independent of client regional settings.

Arvo
Ok. Found it on the server instance under the advanced tab. Thanks.
Riri
There you can set default language for new logins - of course needed too; sorry I forgot that in my response.
Arvo
+3  A: 

Store the data as a regular number - change it only when you display it.

Dani
I need to set up a test database with existing data so this will not work for me
Riri
You can try using @kevchadders idea to convert the data to the regular representation. on the new database.if your app reads a regular number - will it fail ?
Dani
A: 

As i side, if you wished to convert the dot to a comman in a stored proc, then you could use something like this.

DECLARE @numtest as DECIMAL(10,3)
SET @numtest = 123.456
SELECT @numtest -- decimal with dot
SELECT REPLACE(CONVERT(VARCHAR(13), @numtest), '.', ',') -- String with comma
kevchadders