SHARE
TWEET

Get Day Names From Date Range

SQLSoldier Nov 17th, 2015 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Declare @Date1 date = '11/14/2015',
  2.         @Date2 date = '11/17/2015';
  3.  
  4. With TrackTime (TrackTime)
  5. As (Select @Date1 As TrackTime
  6.     Union All
  7.     Select DateAdd(day, 1, TrackTime) As TrackTime
  8.     From TrackTime
  9.     Where TrackTime < @Date2
  10.     )
  11. Select TT.TrackTime, DateName(dw, TT.TrackTime)
  12. From TrackTime TT;
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top