Syntax Validation

  • Comments posted to this topic are about the item Syntax Validation

  • This was removed by the editor as SPAM

  • Nice question Shanjan. Thanks. +1

  • Easy one.[/url]

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • Easy One! thanks.

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • Easy one. Thanks

    [/url]

  • Interesting question, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • SET NOEXEC might find syntax errors but it doesn't find all errors. I copied a piece of code that included a "RANK... PARTITION BY [invalid column]" - I changed everything except the column I was partitioning by (which was actually a mistake on my part). "SET NOEXEC ON" is happy with this but when you actually execute the code, it will fail.

    So, as far as I am concerned, the only way to actually check the syntax of your code is to run it in a development environment which is how I answered this question.

  • happycat59 (4/7/2014)


    SET NOEXEC might find syntax errors but it doesn't find all errors. I copied a piece of code that included a "RANK... PARTITION BY [invalid column]" - I changed everything except the column I was partitioning by (which was actually a mistake on my part). "SET NOEXEC ON" is happy with this but when you actually execute the code, it will fail.

    So, as far as I am concerned, the only way to actually check the syntax of your code is to run it in a development environment which is how I answered this question.

    I get it right, but I agree with you "run it in a development environment".

    I think that the right answers are both "run it in a development environment" and "SET NOEXEC ON" (fifty/fifty).

    😀

  • Carlo Romagnano (4/7/2014)


    happycat59 (4/7/2014)


    SET NOEXEC might find syntax errors but it doesn't find all errors. I copied a piece of code that included a "RANK... PARTITION BY [invalid column]" - I changed everything except the column I was partitioning by (which was actually a mistake on my part). "SET NOEXEC ON" is happy with this but when you actually execute the code, it will fail.

    So, as far as I am concerned, the only way to actually check the syntax of your code is to run it in a development environment which is how I answered this question.

    I get it right, but I agree with you "run it in a development environment".

    I think that the right answers are both "run it in a development environment" and "SET NOEXEC ON" (fifty/fifty).

    😀

    Dev can be different from prod, just because it's dev.

  • Despite popular opinion (see above) there's no "easy" answer to this. NOEXEC is good but it won't find everything and there is the risk that you might miss one somewhere.

    I prefer the "test as much as you can" approach. If Dev is vastly different from Prod then that's an issue which should be addressed.

  • kupy (4/7/2014)


    Carlo Romagnano (4/7/2014)


    happycat59 (4/7/2014)


    SET NOEXEC might find syntax errors but it doesn't find all errors. I copied a piece of code that included a "RANK... PARTITION BY [invalid column]" - I changed everything except the column I was partitioning by (which was actually a mistake on my part). "SET NOEXEC ON" is happy with this but when you actually execute the code, it will fail.

    So, as far as I am concerned, the only way to actually check the syntax of your code is to run it in a development environment which is how I answered this question.

    I get it right, but I agree with you "run it in a development environment".

    I think that the right answers are both "run it in a development environment" and "SET NOEXEC ON" (fifty/fifty).

    😀

    Dev can be different from prod, just because it's dev.

    Sorry, I want to say "run it in a TEST environment".

  • The surest way of validating the syntax is always running it on a test server. NOEXEC and other alternatives will not be able to catch all syntax exceptions.

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com

    Follow me on
    Twitter: @sqltwins

  • Richard Warr (4/7/2014)


    Despite popular opinion (see above) there's no "easy" answer to this. NOEXEC is good but it won't find everything and there is the risk that you might miss one somewhere.

    I prefer the "test as much as you can" approach. If Dev is vastly different from Prod then that's an issue which should be addressed.

    Agreed.. this was my thinking and hence why I got it wrong.

  • Can someone explain how adding a NOEXEC statement and then having to remember to remove it again afterwards is "easier" than just pressing Ctrl-F5 in SSMS?

    In a question like this "None of the above" covers a lot of ground.

Viewing 15 posts - 1 through 15 (of 34 total)

You must be logged in to reply to this topic. Login to reply