jeyis (10/16/2012)
datatype of coldate is datetime,there is no difference in the execution plan of both queries.
Thanks Eugene Elutin for that date format practice .. old habits hard to change .. 🙂
Is it just a query or stored procedure?
Also, why you are not using proper JOINS? That is even worse than not using dates in ISO format...
Can you try this:
DECLARE @dt DATETIME
SET @dt ='20121210'
SELECT *
FROM table1 A
JOIN table2 B ON B.col1 = A.col1
JOIN table3 C ON C.col1 = A.col1
JOIN table4 D ON D.col2 = C.col1
WHERE D.col3 LIKE '%test%'
AND D.coldate > @dt