Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pass timeout parameter to SQL Database Engine

I'm running a query that is timing out for first two times and returning results on the third time.

How do I tell SQL Server to wait until the query is completed instead of timing out?

like image 651
Santosh Chandavaram Avatar asked Jan 24 '23 11:01

Santosh Chandavaram


2 Answers

By default, the SqlCommand.CommandTimeout is set to 30 seconds. You can assign a longer duration before executing the query, or set to 0 for no timeout. (if the question refers to .Net programming)

like image 136
devio Avatar answered Jan 26 '23 02:01

devio


You can also set it connection-wide in the connection string.
"Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=SSPI;Connection Timeout=30"

like image 43
Shane Fulmer Avatar answered Jan 26 '23 02:01

Shane Fulmer