TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Naveen Kumar
NA
73
5k
Count Total Days in the two days range in a year
Aug 8 2014 5:13 AM
I need to count the total days between the date ranges specified in a given year.
alter procedure test @year varchar(10)
as begin
declare @Acount int
Declare @StartDate varchar(20)
Declare @EndDate Varchar(20)
set @StartDate='2014-08-09'
set @EndDate='2014-08-19'
set @Acount=0
if(((YEAR(@StartDate))=@year)and((YEAR(@EndDate))=@year))
SET @ACOUNT=@ACOUNT+CONVERT(INT,(SELECT
(DATEDIFF(dd, @StartDate, @EndDate) + 1)
-(DATEDIFF(wk, @StartDate, @EndDate) * 2)))
print @StartDate
print @Enddate
print @Acount
End
Here i am getting the @Acount as 7 but the Difference between them is 11. I hope so the saturdays and sundays are excluding from them .
But i need the total All days .How to do .
Reply
Answers (
1
)
written Query to this scnario
Help with updating SQL CE table on WinMo 6.5 with C#