SQL Query for detecting Date sequence break
Posted on 2008-06-25
I have one table in SQL Server 2000 database with the following structure.
ID (Identity Column)
Measure Date (DateTime column)
The users enters one record per day per user in this table. Sometimes if user is not operational then Admin can override and enter the 0 amount data for user. Admin can also enter this data in advance for future dates. So the date column data can look like the following for a particuler user.
Now you can notice that there are no dates between 1/5 and 1/9.
My question is how can I identify the break in date sequence using sql query. In above example I want to get either 1/4 or 1/5 as sql query result.