具有德国区域设置的 SQL 服务器 [英] SQL server with german regional settings

查看:29
本文介绍了具有德国区域设置的 SQL 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个数据库应用程序已经运行了几个月,然后突然开始出现错误.

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

我注意到一个日期时间浮点计算异常,它正在与值 0,05 进行比较.我还注意到写入 xml 日志文件的日期格式为 d.mm.yy.

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.

我注意到在数据库连接字符串中,主机被指定为servername\instance,portNumber",正如我预期的正常工作安装的servername\instance:portNumber".

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?

京东.

推荐答案

控制面板.. 区域设置.

Control panel.. regional settings.

这听起来也像是客户端应用程序的问题,而不是 SQL Server.如果它们安装在同一个机器上,则 SQL Server 不会从操作系统区域设置中进行设置.

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 也永远不会识别0,05"auf Deutsch.

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

servername\instance,portNumber"对于 SQL Server 是正确的.

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

这篇关于具有德国区域设置的 SQL 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆