April 7, 2014 at 6:11 am
April 7, 2014 at 6:20 am
Totally subjective again.
April 7, 2014 at 6:58 am
It's nice to show a feature that can help in some circumstances but IMO the "it depends" still apply.
April 7, 2014 at 7:33 am
Stewart "Arturius" Campbell (4/6/2014)
Nice, simple question, thanks.However, always bear in mind to remove the NOEXEC before deploying to a production environment...
+1
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
April 7, 2014 at 7:37 am
Never used this feature NOEXEC before, didn`t find the need to.
Interesting question, thanx 4 sharing 🙂
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
April 7, 2014 at 7:53 am
Ugh, I knew I was going to get this wrong as soon as I read the answers. :rolleyes:
The only thing NOEXEC tells you is that your code compiles. It doesn't catch all syntax errors, and it certainly doesn't tell you if your code syntax is logically correct. I certainly don't think it is the 'best' way to check your code.
April 7, 2014 at 8:07 am
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.
+1 They are all relatively good answers. I agree with Richard in that I wouldn't trust NOEXEC 100% of the time; it's always good to test somewhere other than production and be thorough. A staging, development, test...something; you can never have too many tests. 😀
April 7, 2014 at 8:30 am
Carlo Romagnano (4/7/2014)
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".
I completely agree. Checking in in test, otherwise known as something other than production, is the only way to make sure. NOEXEC doesn't catch everything and the only way to be 100% sure is to run it. As a bonus, it also helps you validate and check your logic to make it's behaving properly.
April 7, 2014 at 8:33 am
I was expecting to use an explicit transaction that will roll back at the end of the code within a try...catch block. This might not be the best option all the time, but it can be safe if done properly.
And of course, use a test environment.
April 7, 2014 at 12:44 pm
If all you are looking for is syntax checking, intellisense can help. Syntax checking does not catch logic errors.
Of course, testing in a non-production environment is always the best way; IMO, anyway.
Tom
April 7, 2014 at 1:30 pm
nice question shanjan.
thanks.
April 7, 2014 at 3:36 pm
I figured the author was looking for NOEXEC but I disagree with the opinion that it is the best way.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 8, 2014 at 11:55 am
Better idea is to run the script on a staging environment that is a clone of production.
April 8, 2014 at 6:24 pm
Manic Star (4/8/2014)
Better idea is to run the script on a staging environment that is a clone of production.
Agree wholeheartedly. I would want to test more than just the syntax before running code in production.
April 9, 2014 at 5:35 am
how is it different from Ctrl+F5 which does the same parsing as NOEXEC does?? pls correct me if am wrong.
______________________________________________________________Every Problem has a Solution; Every Solution has a Problem: 🙂
Viewing 15 posts - 16 through 30 (of 34 total)
You must be logged in to reply to this topic. Login to reply