且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 SQL Server 2005 中设置存储过程的查询超时

更新时间:2022-11-27 13:57:46

正如 Chris Tybur 所说,您不能在存储过程 或 SQL Server 上为存储过程查询超时.

As Chris Tybur said, you can not the the query timeout for a stored proc in the stored proc or on the SQL Server.

CommandTimeout 是一个客户端概念:客户端会在一定时间后中止查询.对于存储过程中止自身/或任何查询,没有死人的计时器或机制).SQL Server 将允许查询永远运行.

CommandTimeout is a client concept: the client will abort the query after a certain amount of time. There is no dead man's timer or mechanism for a stored proc to abort itself /or any query). SQL server will allow a query to run forever.

远程查询超时"就是这样:超时当 SQL Server 进行远程调用时,当 SQL Server 本身是另一台服务器的客户端时.它在说明中说:

The "Remote Query Timeout" is exactly that: timeout when SQL Server makes a remote call, when SQL Server itself is the client of another server. It says in the description:

此值适用于外发由数据库发起的连接引擎作为远程查询.这个值对收到的查询没有影响数据库引擎.

This value applies to an outgoing connection initiated by the Database Engine as a remote query. This value has no effect on queries received by the Database Engine.

最近有一个很好的问题:SQL Server 的超时设置

A recent question with good info: timeout setting for SQL Server