SQL Server date formatting from string

sql, sql-server

Solution

Try this one -

Query:

SET DATEFORMAT ymd

Read current settings:

DBCC USEROPTIONS

Output:

Set Option                 Value
-------------------------- -----------------
...
language                   us_english
dateformat                 ymd
...

Problem

We've recently migrated our database to a different server and since this I think the date format querying has changed somehow. Previously we could use the following.. ``` SELECT * FROM table WHERE date > 'YYYY-MM-DD' ``` However now we have to use.. ``` SELECT * FROM table WHERE date > 'YYYY-DD-MM' ``` Can someone tell me what I need to change to get back to the previous version?

Original source