Quote:
Originally Posted by pavansap
members scheduled for an interview within 10 business days and i should exclude sundays in this...
Select (DATEDIFF(day,b.startDate,b.Endadate) +1) - (DATEDIFF(wk,b.StartDate,b.Endadate)*2)
- (CASE WHen DATENAME(dw,b.startdate)='SUNDAY' THen 1 else 0 end)
- (CASE when DATENAME(dw,b.endadate)='SATURDAY' then 1 else 0 end)
|
1. Check your syntax
DateDiff
DateDiff returns a number of time intervals between two specified dates
Syntax:
DateDiff (intervalType, startDateTime, endDateTime)
DateDiff (intervalType, startDateTime, endDateTime, firstDayOfWeek)
• intervalType is a String expression that is the interval of time you use to calculate the difference between startDateTime and endDateTime.
• startDateTime is the first DateTime value used in calculating the difference.
• endDateTime is the second DateTime value used in calculating the difference.
• firstDayOfWeek is an optional constant specifying the first day of the week.
Returns
A Number value
2. Elaborate on what you want to do
Don't know why you are finding date difference for "members scheduled for an interview within 10 business days and i should exclude sundays in this". If you can explain what you want to do, maybe someone can help.