timing a query

  • Thread starter Thread starter Uzi
  • Start date Start date
U

Uzi

Hi!

is there a way to limit the time a Database query executes ?

im looking for something like the timeout property, but on the query itself.

Thanks,
Uzi
 
Use CommandTimeout proprty on the sqlCommand object.

[C#]
public virtual int CommandTimeout {get; set;}

Property Value
The time (in seconds) to wait for the command to execute.
The default is 30 seconds.

Implements
SqlCommand.CommandTimeout

if the value of 0 is set then it indicates no limit, and
should be avoided in a CommandTimeout because an attempt
to execute a command will wait indefinitely.
 
If you use sp_configure to change the value of query governor cost limit,
the
changed value is server-wide. To change the value on a per connection basis,
use the SET QUERY_GOVERNOR_COST_LIMIT statement.
 
Back
Top