Working around globalization issues when executing T-SQL
In an app, where SQL server databases with schemas and locale unknown at compile-time (determined at runtime) can be plugged in, I need to figure out how to update a decimal field - ie. what de开发者_StackOverflow中文版cimal separator to use.
So against one server, if I need to update a decimal field, I would send 100.125. On another server that would be interpreted as 100,125.
I use oldschool SqlCommand-class to do so, since I do not know the schema at compile-time.
At runtime, can I determine which separator I should use? Or is there another way of handling this, that I am overlooking?
There is some discussion on that issue here.
Can you supply some context to your query why just using a dot wouldn't work?
As far as I understand it
UPDATE tbl SET Col = 1.23
would work anywhere and you would only get problems if you did
UPDATE tbl SET Col = '1.23'
精彩评论