将 SQL Server 数据库而不是整个服务器上的日期格式更改为 dd/mm/yyyy

2022-01-15 00:00:00 datetime format date sql-server

任何人都可以帮忙,我们安装了一个 sql server 2005 数据库(实际上它是一个连接到 sql server 2005 服务器的 sql server 2000),默认服务器语言语言 USA 具有像 mm/dd/yy 这样的日期格式,我们真的需要保持这种方式,但目前刚刚将一个新数据库上传到服务器,这需要具有 dd/mm/yyyy 的日期格式.

can anyone help, we have a sql server 2005 database installed (actually its an sql server 2000 attached to an sql server 2005 server) with the default server language language USA with dateformat like mm/dd/yy and we really need to keep it this way but currently just uploaded a new database to the server and this needs to have the dateformat for dd/mm/yyyy.

我可以只在数据库而不是整个服务器上强制更改吗?如果我在整个服务器上强制更改,它将使我所有其他应用程序失败

Can i force a change just on a database and not the whole server? If i force the change on the whole server it will make all my other apps fail

例如,目前我们有这个失败的 sql 语句..

For example currently we have this sql statement which fails..

SELECT * FROM 会话 WHERE ultimo_acceso <'16/04/2009 13:36:17'

SELECT * FROM sesiones WHERE ultimo_acceso < '16/04/2009 13:36:17'

当然我们可以添加这个现在可以使用的东西

but of course we can add this which now works

SELECT * FROM 会话 WHERE ultimo_acceso <转换(日期时间,'16/04/2009 13:36:17',103)

SELECT * FROM sesiones WHERE ultimo_acceso < Convert(datetime, '16/04/2009 13:36:17', 103)

但问题是应用程序中有大量的 sql 语句.事实上,该应用程序已经相当老了,我们真的不想对源代码进行任何更改..

but the problem being is that there are a large number of sql statements within the application. The truth being is that the application is fairly old and we don't really want to make any changes to the source code..

因此,如果我们可以强制更改数据库/特定数据库的表,那么这就足够了

SO hence if we could force a a change just on the Database / the tables of specific database then this would suffice

非常感谢任何帮助

推荐答案

您可以通过在 SQL 中为该用户选择 默认语言 来更改每个 用户 的默认日期格式Management Studio > 安全 > 登录 > {用户属性} > 默认语言.

You can change the default date format per user by selecting the default language for that user in SQL Management Studio > Security > Logins > {user properties} > Default language.

您可以使用

EXEC sp_helplanguage

相关文章