How to set timeout for a stored procedure in SQL Server
I have a stored procedure in SQL Server, I want to set a time out for my sprpc so that if it does not finish in appropriate time, SQL Server forces it to stop.
t开发者_开发问答hanks
Since you asked specifically about how to set the timeout value, I'll tell you, but I agree with the comment OMG Ponies
made, that you are far better off if you figure out why the query is taking so long. To start reading about query optimization, read this and this.
Here are the steps to setting the Query Timeout on the server:
- Locate your server in SQL Server Management Studio.
- Right click on the server name.
- Select properties.
- Choose the Connections tab.
- Set the query timeout value. (The value is in seconds. Set it to 0 for unlimited time)
- Click OK.
精彩评论