How to control ExecuteNonQuery
I mean hypothetically is it possible to control query execution?
For example I got a big query and it does a lot of things but suddenly it gets an error, but I don't want to stop its execution, I just wanna skip that step and continue further.
Or I want to let the user know what's going on, what's actually is happening on the server right now.
Can I have some feedback from Sql server? Like "Just deleted the trigger successfully" or "I just Screwed with table alternation... So-n-so" 开发者_如何学Go
You could try breaking your stored procedure up into several smaller pieces and wrapping them all in a transaction.
Sure you can. Use
SAVE { TRAN | TRANSACTION } { savepoint_name | @savepoint_variable }
[ ; ]
http://msdn.microsoft.com/es-es/library/ms188378.aspx
With saved points, you can have grain control over which statements commit or not.
And at the end, you can return this information to your app by out variables or a table with information.
精彩评论