Friday, September 27, 2013

SQL Server date formatting from string

We’ve recently migrated our database to a different server & 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 alter to obtain back to the previous version?

Try this one –

Query:

SET DATEFORMAT ymd

Read current settings:

DBCC USEROPTIONS

Output:

Set Option                 Value-------------------------- -----------------...language                   us_englishdateformat                 ymd...

No comments:

Post a Comment