Quick Overview The query analyzer is a kind of double edged sword. You can just wipe out the entire database in just a couple of statements. Hence, whenever it involves an update or delete with an involved where clause, it is better to have it associated with a select first and then comment it out before linking with the actual update. While, many would resort to this, SQL itself comes with another syntax-checking mode called 'set parseonly on'.
MSDN URL: http://msdn.microsoft.com/en-us/library/ms178629.aspx
The SQL Way If you just want to make sure of the syntax, just have this executed before the real statements.
set parseonly on
The .NET Way The Microsoft.SqlServer.Management.Common comes with an enumeration to control the ParseOnly for ExecuteNonQuery. But I haven't yet delved deeper into it. Just thought of sharing this with other developers and hence putting it as a tip.
Conclusion Hope this would be a quick and useful tip for developers fiddling around with SQLDb more carefully.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|