Procedure times out from ADO.NET but not in SSMS

前端 未结 1 1318
旧时难觅i
旧时难觅i 2020-12-11 22:43

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

相关标签:
1条回答
  • 2020-12-11 23:04

    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.

    0 讨论(0)
提交回复
热议问题