Jocke
Jocke

Reputation: 2284

SQL Sever Execution time-out vs .NET SqlCommand.CommandTimeout. Who wins?

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

Upvotes: 0

Views: 3874

Answers (2)

AlexS
AlexS

Reputation: 2386

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'.

Upvotes: 2

gbn
gbn

Reputation: 432180

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

Upvotes: 1

Related Questions