I\'ve got a stored procedure that is giving me a SqlException because of a timeout when I run it from code (with timeout set to 30). When I run the procedure directly in Man
You can compare the SET options for the session that is timing out to those from the session that is not:
SELECT
session_id,
[ansi_defaults],
[ansi_null_dflt_on],
[ansi_nulls],
[ansi_padding],
[ansi_warnings],
[arithabort],
[concat_null_yields_null],
[deadlock_priority],
[quoted_identifier],
[transaction_isolation_level]
FROM
sys.dm_exec_sessions
WHERE
session_id IN (<spid1>, <spid2>);
When you find some that are different, experiment with changing each setting to the opposite in your SSMS query until you get the timeout (or manually setting the option(s) in your app code before sending the query). Now, I don't have a 2005 instance handy, so have not tested this query. You may need to comment out one or more column names.