0

How to find saturday and sunday between two dates in sql

i tried

Select DATEDIFF(WW, '2014-05-08 12:49:56.000','2014-05-10 17:07:30.000')

but it's not taking saturday. Please help me

Amul
  • 11
  • 10
  • [Should](http://www.codeproject.com/Tips/639460/Find-All-the-Days-Between-Two-Dates) be a [good](http://stackoverflow.com/questions/19765962/calculating-days-to-excluding-weekends-monday-to-friday-in-sql-server) [start](http://stackoverflow.com/questions/252519/count-work-days-between-two-dates). – Dominik Antal Jun 24 '14 at 12:19

1 Answers1

0

Try this,

alter procedure p_Ex
(@FDate datetime,@Tdate datetime)
as
begin

select x.Day from 
(
select  DATENAME(DW, CAST(CAST('u r Column Name'AS VARCHAR(10)) AS DATE)) AS [Day] from YourTableName
)X
Where X.Day='Sunday' OR X.Day='Saturday'
end;

exec p_Ex '2014-05-08 12:49:56.000','2014-05-10 17:07:30.000'

vinoth_S
  • 27
  • 2