Hi,I hope somebody can help me. Thank you. 1. I have a confirmed date column in my table that i need to determined if that date is within the range. if within in range i have to put a remarks.2. if the date format is '1/1/1900' and '1/1/2099' the remarks is 'NO ETA'3. The year should be dynamic. Given is the sample data.Drop table #sampleCreate Table #sample(ConfirmedDate datetime)insert into #sample(ConfirmedDate) values ('1/1/1900')insert into #sample(ConfirmedDate) values ('1/1/2099')insert into #sample(ConfirmedDate) values ('11/29/2013')insert into #sample(ConfirmedDate) values ('12/30/2013')insert into #sample(ConfirmedDate) values ('4/1/2014')insert into #sample(ConfirmedDate) values ('3/12/2014')insert into #sample(ConfirmedDate) values ('5/1/2014')insert into #sample(ConfirmedDate) values ('2/24/2014')insert into #sample(ConfirmedDate) values ('2/14/2014')insert into #sample(ConfirmedDate) values ('4/25/2014')insert into #sample(ConfirmedDate) values ('5/1/2014')insert into #sample(ConfirmedDate) values ('5/10/2014')insert into #sample(ConfirmedDate) values ('6/20/2014')insert into #sample(ConfirmedDate) values ('6/25/2014')insert into #sample(ConfirmedDate) values ('7/20/2014')insert into #sample(ConfirmedDate) values ('8/25/2014')insert into #sample(ConfirmedDate) values ('8/20/2014')insert into #sample(ConfirmedDate) values ('10/30/2014')insert into #sample(ConfirmedDate) values ('11/20/2014')insert into #sample(ConfirmedDate) values ('12/10/2014')insert into #sample(ConfirmedDate) values ('11/24/2014')insert into #sample(ConfirmedDate) values ('12/25/2014')select ConfirmedDate, Case When ConfirmedDate ='1900-01-01 00:00:00.000' OR ConfirmedDate ='2099-01-01 00:00:00.000' Then 'NO ETA' End As Remarksfrom #sample
Sample Date RangeREMARKS---SAMPLE DATE RANGE-------------------------------NO ETA --Previous JAN ETA --12/21/2013 1/20/2014FEB ETA --1/21/2014 2/20/2014MAR ETA --2/21/2014 3/20/2014APR ETA --3/21/2014 4/20/2014MAY ETA --4/21/2014 5/20/2014JUN ETA --5/21/2014 6/20/2014JUL ETA --6/21/2014 7/20/2014AUG ETA --7/21/2014 8/20/2014SEP ETA --8/21/2014 9/20/2014OCT ETA --9/21/2014 10/20/2014NOV ETA --10/21/2014 11/20/2014DEC ETA --11/21/2014 12/20/2014NO ETA --1/1/1900 NO ETA --1/1/2099