Home Forums SQL Server 7,2000 General Bizarre issue while using datetime variable instead of harcoded value RE: Bizarre issue while using datetime variable instead of harcoded value

  • 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

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]