I have table in Ms SQL Server 2005 (2008) in following structure
ID Name AddDate AmendDate Status
-----------------------------------------------------------------------
1 Jason 2012-09-03 08:01:00.000 2012-09-03 14:02:00.000 Amended
2 Robert 2012-09-03 08:05:00.000 NULL New
3 Celia 2012-09-03 08:10:00.000 2012-09-03 14:02:00.000 Amended
4 Jason 2012-09-03 14:02:00.000 NULL New
5 Robert 2012-09-03 14:03:00.000 2012-09-03 20:02:00.000 Amended
6 Celia 2012-09-03 14:07:00.000 2012-09-03 20:02:00.000 Amended
7 Jason 2012-09-03 20:00:00.000 NULL New
8 Robert 2012-09-03 20:02:00.000 NULL New
9 Celia 2012-09-03 20:04:00.000 NULL New
routine runs three times per day as snapshot,
please how can I by using SQL Query
select all record from morning (or evening) for any of days
how can I replace (
ISNULL(AmendDate, '2012.09.04')) for columnAmendDatewhere isNull value, in the case when I walking in history, for example returns all row thatAddDate <= '2012-09-01' and AmendDate >= '2012-09-02'question is about
SELECT - FROM - WHERE -only
"walking in history"I meaning resultset from (for example) morning fromjanuary,aprilor e.i. ..., and in the case that value isNULLI want to addNOW()orDATE() +1, or better is useAmendDate >= '2012-01-15' OR AmendDate IS NULLRecordisAmendedor not, maybe replaceNULLtoDATE +1is wrong way, sorry for myNavajo language