Reputation: 13
I have a decimal field and when I convert the string '1000,00' to decimal on my machine with SQL Server in portuguese it saves correctly 1000 but at the server, where the OS is in english, it saves 100000.
I've already set the regional settings to portuguese and the database collation to Latin1_General_CI_AS.
What I failed to do on the server?
Upvotes: 1
Views: 387
Reputation: 56576
You should transfer it between the computers as a decimal
(or other appropriate number type) and store is as a numeric type, if possible, not a string
. If you do need to use a string
at all, use the invariant culture where appropriate to convert to and from the number type, to avoid locale errors like this.
In short, the culture of the server should never come into play: you should make it fixed.
Upvotes: 1