Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
UPDATE Elig SET EndDate =
(SELECT MAX(CONVERT(char(8),Row_End_Dt,112))
FROM Enrollment
WHERE ID = Mbr_ID AND CovType = 'DD'
AND EffDate BETWEEN Row_Eff_Dt AND Row_End_Dt
AND EndDate > Row_End_Dt)
WHERE EXISTS (SELECT 'X' FROM Enrollment
WHERE ID = Mbr_ID AND CovType = 'DD'
AND EffDate BETWEEN Row_Eff_Dt AND Row_End_Dt
AND EndDate > Row_End_Dt)
Posted
Comments
DaveAuld 11-Nov-11 11:51am    
What do you mean by taking too much? Without knowing your schema and what you are trying to do it would be difficult to provide the best optimisation.
Mehdi Gholam 11-Nov-11 12:24pm    
Use the SQL Profiler to see what is going on and it will give you index suggestions.

1 solution

SQL Server Management Studio is pretty useful in Performance Monitoring. Or else, you can review the query execution plan.
 
Share this answer
 
Comments
JamesWinter 14-Nov-11 9:25am    
taking too much time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900