Quote:
I noticed that if I executed the same batch twice
in a row, the second time it would complete immediately (and say it was
|
successful), but it wouldn't actually do anything... <<
What did you expect it to do the second time? Once teh update is made,
there is nothign else to do with the data, is there? So the second
execution looks for qualified rows; there are none; it goes home
without change the base table, the indexes or anything else. It is
effectively an empty SELECT.
Quote:
Ignoring the fact that maybe I could do this better another way than
using cursors ..
|
UPDATE Call_By_Call_Yesterday_Final
SET inter_call_id
= CASE WHEN @site_name = 'SYMPTEEC'
THEN 'PZ'
WHEN @site_name = 'SYMPPEEZ'
THEN 'TC'
ELSE inter_call_id END
+ RIGHT(call_id, 8)
WHERE call_id
= CASE WHEN @site_name = 'SYMPPEEZ'
THEN 'PZ'
WHEN @site_name = 'SYMPTEEC'
THEN 'TC'
ELSE NULL END
+ STR(@intercall_id, 8)
AND ABS(DATEDIFF(S, @timestamp,
Call_Bycall_Yesterday_Final.time_arrived))
< 900;