0

I tried to find the answer search this page and google with no luck!

If I change the "Execution time-out" on the SQL Server instance (Tools->Options->Query Execution) and sets the SqlCommand.CommandTimeout in the .NET code using the SQL Server. Which property wins?

Cheers --Jocke

2 Answers 2

2

Timeout is a connection-level property - it applies to each individual connection.

When you go to 'Tools->Options->Execution timeout' you affect only newly created connection in SQL Server Management Studio - it does not apply to SQL Server Instance you're running queries against.

So SqlCommand.CommandTimeout will certainly 'win'.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your reply AlexS. So even if I create a new connection (after changing the property on the server) the sqlCommand.CommandTimeout will 'override' Execution timeout?
Yes, that's right. In fact, the setting in SQL Management Studio you're referring to is applied only to connections opened by this instance of SQL Management Studio itself.
There is nothing to "win". SQL Server engine does not have "command timeout" concept
1

When you go to "Tools->Options->Execution timeout" in SSMS this sets SqlCommand.CommandTimeout for SSMS. No more, no less.

There is no equivalent setting in the SQL Server engine to SqlCommand.CommandTimeout: SQL Server will not abort a query for a command timeout because it doesn't issue the command. The client does

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.