Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
An update which does not finish
Message
From
21/04/2015 00:02:39
 
 
To
20/04/2015 13:23:43
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01618796
Message ID:
01618837
Views:
52
>
>UPDATE Client
> SET DayBetweenFirstDateSecondDate=
>  (SELECT SUM(Temp.SecondValue)/3600.0/8 AS HourValue
>  FROM (SELECT DATEDIFF(SECOND,
>   CASE WHEN BusinessTime.Start>Client.FirstDate THEN BusinessTime.Start ELSE Client.FirstDate END,
>   CASE WHEN BusinessTime.[End]<Client.SecondDate THEN BusinessTime.[End] ELSE Client.SecondDate END) AS SecondValue
>   FROM BusinessTime
>   WHERE BusinessTime.NoProvince=84 AND BusinessTime.NoHoliday=0 AND 
>    ((BusinessTime.Start>=Client.FirstDate AND BusinessTime.Start<=Client.SecondDate) OR
>    (BusinessTime.[End]>=Client.FirstDate AND BusinessTime.[End]<=Client.SecondDate))) Temp)
>
>

Michel,

I haven't read all the messages in this thread so I don't know if you found an answer. If you haven't...

1) Can you post the estimated (or actual) execution plan
2) Can you post the structure for the Client and Business Time tables?

Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform