Change default date time format on a single database in SQL Server

前端 未结 8 1143
孤城傲影
孤城傲影 2020-11-30 05:16

I need to change the date format from US (mm/dd/YYYY) to UK (dd/mm/YYYY) on a single database on a SQL server machine.

How can this be done?

I\'ve seen state

相关标签:
8条回答
  • 2020-11-30 05:40

    Although you can not set the default date format for a single database, you can change the default language for a login which is used to access this database:

    ALTER LOGIN your_login WITH DEFAULT_LANGUAGE=British
    

    In some cases it helps.

    0 讨论(0)
  • 2020-11-30 05:42

    In order to avoid dealing with these very boring issues, I advise you to always parse your data with the standard and unique SQL/ISO date format which is YYYY-MM-DD. Your queries will then work internationally, no matter what the date parameters are on your main server or on the querying clients (where local date settings might be different than main server settings)!

    0 讨论(0)
提交回复
热议问题