TimeoutException in SQL Server 2005 migrated from SQL Server 2000
I've recently updated an MSSQL server from 2000 version to 2005, to make use of UDFs and tweak some results in a system. The thing 开发者_Python百科is that we don't have the source code.
So, I replaced the SQL version, and every worked fine... except when we have to do a large query. I'm getting this error:
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I've searched about it, and what I get is that it use to be a CommandTimeout
issue that I have to solve programmatically, as it is supposed to be in the client side, but this is weird, because it always worked even with big queries.
My guess is that is not something Client Side because in SQL Server 2000 worked fine.
Is there any way to remove any kind of timeout? The system is completely internal and only a few people uses it, so there's no risk of outages... I prefer a query running forever that this annoying messages.
Thanks in advance!
Have you updated all statistics after the upgrade?
How to: Upgrade to SQL Server 2005 (Setup)
After upgrading the Database Engine to SQL Server 2005, complete the following tasks:
...
Update statistics - To help optimize query performance, we recommend that you update statistics on all databases following upgrade. Use the sp_updatestats stored procedure to update statistics in user-defined tables in SQL Server 2005 databases.
Update usage counters - In earlier versions of SQL Server, the values for the table and index row counts and page counts can become incorrect. To correct any invalid row or page counts, we recommend that you run DBCC UPDATEUSAGE on all databases following upgrade.
You can set the timeout on the connection either in your config file or at time of setting connection.
SqlCommand1.CommandTimeout = 400000
精彩评论