SQL Server : Change dateformat for every connection

Viewed 1332

Is it possible to change dateformat from DMY to YMD only for new connections?

I tried a LOGON trigger using SET DATEFORMAT YMD but always the default DMY is back.

So I want to keep the default DMY into database however for new sessions (connections) I want to change to YMD.

2 Answers

I believe it is tied to the language of your server which you can look up like this:

USE [master]
GO

SELECT * FROM [syslanguages]

then you need to run sp_config with the langid from the first query

EXEC sp_configure 'default language', 'langid'
GO;
RECONFIGURE
GO;

I had the same problem and I found the solution. SQL management studio gets the data format from your local windows settings.

  • Click on the clock (windows)
  • Click on Change data and time settings...
  • Click on Change calendar settings
  • Go to Date tab
  • Change the Short date format to: yyyy-MM-dd

that is it.

Related