0

I have a list of dates and other columns in which have to find the weekend dates among them and the the weekend dates should be there in the list of given dates

enter image description here

Output should be some thing like this...

enter image description here

Any help is appricated thanks.

Vinay
  • 111
  • 1
  • 3
  • 15
  • You can use datename as explained here http://stackoverflow.com/questions/1110998/get-day-of-week-in-sql-2005-2008 – Gabriel May 26 '14 at 14:07
  • I am marking this as a duplicate. However, if the question has internationalization issues, then the duplicate is not appropriate (the question doesn't mention these, however). – Gordon Linoff May 26 '14 at 14:08
  • plz read my question ....the link you hv given is not my requirement – Vinay May 26 '14 at 14:18
  • i want weekend dates from given list, the resultent dates should be ther in the list – Vinay May 26 '14 at 14:22

1 Answers1

0

use datepart (dw,.. to filter data needed

Horaciux
  • 6,322
  • 2
  • 22
  • 41
  • i hv tried this select DATEADD(dd, 7-(DATEPART(dw, #t.Date1)), Date1) as WEEKENDDAY from #t group by DATEADD(dd, 7-(DATEPART(dw, #t.Date1)), #t.Date1) – Vinay May 26 '14 at 14:10
  • output is :2014-04-12 00:00:00.000 2014-04-19 00:00:00.000 – Vinay May 26 '14 at 14:11
  • can u help me with the example – Vinay May 26 '14 at 14:38
  • @mvinay I just realize '2014-04-09' and '2014-04-16' are not weekends and you put them as desired output. I'm afraid I misunderstood your request. Could you check if '2014-04-12' and '2014-04-13' should be the right output? – Horaciux May 26 '14 at 14:51
  • ya these two dates are not weekends but they are the last dates in the given dates list – Vinay May 26 '14 at 14:55
  • @mvinay I wanna help you, but I don't undestand your request. Please edit your question with other words and examples. – Horaciux May 26 '14 at 14:59