I have an issue with a SQL server that I could do with some help with.
When I run a select statement with a date range in the where it returns rows from the wrong date range.
e.g. If I execute the following
select * from theTable where startDate between '2016-09-01 00:00:00' and '2016-09-08 23:59:59'
select * from sys.syslanguages order by name where name = @@language
isolation level read committed
print month('2016-09-01 00:00:00')
Microsoft SQL Server 2005 - 9.00.5057.00 (X64)
Mar 25 2011 13:33:31
Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)
You would appear to have a relatively unusual internationalization setting, where the default is YDM rather than YMD.
You can always use dates without hyphens:
select * from theTable where startDate >= '20160901' and startDate < '20160909';
These are always interpreted as YYYYMMDD in SQL Server.