开发者

Is there a way to get Stored Procedures to constantly refresh their Timeout Expiration TSQL?

I wrote a pretty complex Stored Procedure that takes about 2 minutes to run开发者_JAVA百科 (Is is a single Update statement). However, in this 2 minutes of time the stored procedure times out. I was wondering if there was a way to refresh the Stored Procedures timeout expiration so that I don't have to change the servers timeout from 30 seconds. I cannot really break the stored proc up any more than it already is so running multiple smaller versions of the stored proc is kind of off the table. It would be nice to say somewhere in the stored procedure like every time the stored proc successfully updates a row, refresh the timer so that it can update all the rows without timing out. Any advice would be appreciated. Thanks.


No. The command time out is purely a client side thing.

What happens with CommandTimeout is, SQL Server will just chug along performing a query and doesn't know anything about a timeout, and when the client determines that the query is taking too long, it will then send a message to the server telling it to cancel the query. So, since the timeout value is purely a client-side thing, you won't be able to change it inside SQL Server.

You would need to increase the CommandTimeout in the calling code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜