开发者

how to get the errors in management studio on a script with cursor inserting lots of data?

I wrote a script in management studio that uses nested cursors and it inserts data in different tables.

Since many insert statemnets are executed there are many messages like

231 line(s) affected

the problem is that it seems there is a limit for these messages. So after a while they are not displayed anymore.

So if the error happens in the first "cursor loops" I see the error message, but if it happens near the end the error is not displayed, I just see a generic "Query completed with errors".

In my particular case I simply started inserted from the end (so the error came at first and I found the problem.

But how to do better?

开发者_如何学PythonIdeally I would like to have an option to log in the messages, just the errors, not the

231 line(s) affected

kind of messages.

Which technique do you suggest?


Add SET NOCOUNT ON at the top to suppress these messages?

Note: this doesn't affect @@ROWCOUNT if you use it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜