What does SQL Server do with a timed out request?

后端 未结 2 1392
陌清茗
陌清茗 2021-01-02 01:47

Suppose that I use C# to run a long running SQL Server stored procedure (lets say 30 minutes). Further suppose that I put a 1 hour timeout period on the query in C# such tha

2条回答
  •  一整个雨季
    2021-01-02 02:41

    The timeout is something that happens on the connection, not the running query.

    This means that your BEGIN CATCH will not execute in the event of a timeout, as the query has no idea about it.

    Write your cleanup in C#, in a catch(SqlException ex) block (testing for a timeout).

提交回复
热议问题