|
Posted by David Portas on 10/20/05 01:11
Here's a guess. I'm assuming that (provideroid, appointmenteffdate) is
unique in @main_temp. If you need more help then please post DDL /
DECLARE statements so that we don't have to guess at keys and
constraints - that's pretty important information for solving data
manipulation problems.
DELETE T
FROM @main_temp AS T
WHERE EXISTS
(SELECT *
FROM @main AS M
WHERE M.provideroid = T.provideroid
AND M.appointmenteffdate
< DATEADD(MINUTE,T.appointmentduration,T.appointmenteffdate)
AND DATEADD(MINUTE,M.appointmentduration,M.appointmenteffdate)
> T.appointmenteffdate
AND M.appointmenteffdate < T.appointmenteffdate) ;
(untested)
Alternatively, why bother deleting the rows at all from the table
variable? Just ignore the unwanted rows until you discard the variable.
--
David Portas
SQL Server MVP
--
Navigation:
[Reply to this message]
|