有没有办法让存储过程不断刷新它们的超时过期TSQL?

发布于 2024-09-13 18:13:41 字数 216 浏览 0 评论 0原文

我编写了一个相当复杂的存储过程,运行大约需要 2 分钟(Is 是单个 Update 语句)。然而,在这 2 分钟的时间内,存储过程超时了。我想知道是否有办法刷新存储过程超时过期,这样我就不必将服务器超时更改为 30 秒。我无法真正分解存储过程,因此运行多个较小版本的存储过程有点不可能。最好在存储过程中的某个地方说,例如每次存储过程成功更新一行时,刷新计时器,以便它可以更新所有行而不会超时。任何建议将不胜感激。谢谢。

I wrote a pretty complex Stored Procedure that takes about 2 minutes to run (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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相权↑美人 2024-09-20 18:13:42

不。命令超时纯粹是

CommandTimeout 会发生什么情况,
SQL Server 将继续运行
执行查询但不知道
关于超时的任何事情,以及当
客户端确定查询是
花费太长时间,它会发送一个
向服务器发送消息,告诉它
取消查询。所以,自从
超时值纯粹是客户端的
事情,你将无法改变它
SQL Server 内部。

您需要增加调用代码中的CommandTimeout

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文