• Brett Robson (5/20/2010)


    I don't see why you guys are promotiing the use of dynamic SQL. I'm often asked in job interviews when it's appropriate to use dynamic SQL - the correct answer is never.

    I have never (and will never) see dynamic SQL out perform a properly coded & compiled stored procedure. It's impossible - NOTHING gets cached.

    "Never" and "Always" hardly apply to the database world. "It depends" fits better.

    You have two possibilities:

    1) Keep your idea that dynamic sql is evil and should never be used

    2) Read the excellent articles (especially Erland Sommarskog's and Gail Shaw's blogs) that were linked in this thread and try to learn something

    The coiche is yours.

    -- Gianluca Sartori