How to display between dates from one date to another

Posted by Oswaldlily under Sql Server on 1/10/2012 | Points: 10 | Views : 1554 | Status : [Member] | Replies : 3
FROM JAN 15 TILL APRIL 19 I WANT TO DISPLAY ALL DATES IN LABEL FORMAT

SO MY QUERY IS
=>TO GET START DATE =>select CONVERT(varchar(10),getdate()+5,111)

=>TO GET LAST DATE=> select CONVERT(varchar(10),getdate()+100,111)

HOW TO DISPLAY BETWEEN DATES




Responses

Posted by: Sksamantaray on: 1/10/2012 [Member] Silver | Points: 25

Up
0
Down
Question in not clear

Thanks,
Sanjay

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niladri.biswas on: 2/8/2012 [Member] Platinum | Points: 25

Up
0
Down
;With CalenderCTE(dt) AS

(
Select Cast('2012-01-15' As Date) As StartDate --Jan 15th 2012
Union All
Select DateAdd(Day, 1, dt) As EndDate
From CalenderCTE
Where dt < Cast('2012-04-19' As Date) -- April 19th 2012
)
select CONVERT(varchar(10),dt,111) DtCalender
From CalenderCTE


Hope this helps

Best Regards,
Niladri Biswas

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishaq on: 2/13/2012 [Member] Starter | Points: 25

Up
0
Down
select * from tablename where columnname between 'from-date-value' and 'last-date-value'


Abdul

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response