Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
An update which does not finish
Message
De
21/04/2015 00:02:39
 
 
À
20/04/2015 13:23:43
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01618796
Message ID:
01618837
Vues:
49
>
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform