June 17, 2011 at 12:51 pm
What is the error you are receiving?
When I run the query against the data set provided, the result is 61, and I'm able to multiply it by 24 without any problem.
~Rusty
June 17, 2011 at 12:55 pm
Could you tell me where did you do that multiplication I mean the Query
June 17, 2011 at 1:02 pm
Here you go...
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)) * 24
from Balla b where Proj_ID=123;
June 17, 2011 at 1:10 pm
oops thats a bit stupid one. I didnt check the brackets properly.
Actually I am trying to design a query that would allocate the number of hours per month based on the available days in a month.
Say In june there are 15 days so in the result of 1484 some hrs be allocated. IN that way
Anyways thanks
June 17, 2011 at 6:31 pm
At this point, my recommendation would be to build a Calendar or Date table. If you have problems finding a good one on Google or Yahoo (or whatever your favorite search engines are), c'mon back and we'll help you get started. But give it a look-see on your own, first. 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply