tags:

views:

142

answers:

1

Hi,

We have a database application that has been running for months, then suddenly it started to give errors.

I noticed a datetime float calculation exception that which was being compared with the value 0,05. I also noticed that dates being written to our xml log file were in the format d.mm.yy.

Clearly, the decimal operator being used is ',' and the date separator is '.'.

The application was initially installed using the UK english regional settings. I checked that the regional settings which were still UK english.

I noticed in the database connection string, the host was given as "servername\instance,portNumber", where as I expected "servername\instance:portNumber" for an normal working installation.

Any ideas where the regional settings are obtained from? Also, could it be the user they are using to run apps against the database or the user that runs the database?

JD.

+2  A: 

Control panel.. regional settings.

This sounds like a client app issue too, not SQL Server. If they are installed on the same box, SQL Server does not take settings from the OS locale.

It could be that the user of the app has german locale and some data is being passed as string, when it should be float or datetime already (with client doing locale handling)

SQL Server will also never recognise "0,05" auf Deutsch too.

SET LANGUAGE GERMAN

DECLARE @val float
SET @val = 0,05 --fail
GO
DECLARE @dt datetime
SET @dt = '23 Mrz 2009' --fail
GO
DECLARE @dt datetime
SET @dt = '23.03.2009' --ok
GO

And "servername\instance,portNumber" is correct for SQL Server.

gbn
SQL server and the app are on the same box. I checked regional settings and it was set to UK (english) settings. Not sure where else to look. With the current configuration, it appears that sql server is run under one user account, the app in another.
JD
>> could be that the user...has German locale...being passed as string<< We're pushing internationalisation of our app precisely because of this issue - one of our app components failed on getting fractional euros.
DaveE
@JD: 1. I guess the app is passing strings to SQL Server, not native datatypes. If so, you need to ensure the user for the app needs to be in uK english, despite what it says for you or for the default. We manage different locales because we separate presentation/capture from SQL calls to we'd always send "0.05" to our server even if a German user enters "0,05"
gbn
@gbn : Just checked the locale of the user running the client app, it is in UK (english). No idea where to go from here. All I know it was working for months and then we started getting these errors (as I said before we also write to a log file and the dates started using "." as a separator of the log date-time).
JD
@jd. OK, what does SQL Server think it is? Or does it use an ODBC DSN with some messed up settings. The german settings must be coming from somewhere...
gbn
@gbn : Due to the pressures (the germans can be pushy :)), we changed the application to handle it for now. When we have more time, we will look at it again. Thanks once again for all the help.
JD