How does SQL Server decide format for implicit datetime conversion?

后端 未结 3 2071
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-03 07:43
declare @str_datetime varchar(50)
set @str_datetime=\'30-04-2012 19:01:45\' -- 30th April 2012
declare @dt_datetime datetime
select @dt_datetime=@str_datetime
         


        
3条回答
  •  醉话见心
    2020-12-03 08:06

    You can also change de default date format for each logins and/or for each future added logins (without the needs to do "SET DATEFORMAT" in each session.

    You go in SQL Management Studio / Security / Logins. Right-clic the login, then Properties. You will see "Default Language" at the bottom.

    If you want to make sure any logins added in the future get the "good" language. You right-click on your server root, then Properties and Advanced page. There is an option "Default Language" there too that is used to newly created logins.

提交回复
热议问题