My instinct said that the procedure would still be executed, so I put together a simple test.
SQL:
Create Procedure TestDelay AS waitfor delay '00:00:40' update table_1 set dt = getdate()
And in VB.Net (same as C # for this purpose):
Dim con As New SqlConnection(myconnectionstring) Dim com As New SqlCommand("TestDelay", con) com.CommandType = CommandType.StoredProcedure con.Open() Try com.ExecuteNonQuery() Catch ex As Exception con.Close() Response.Write(ex.Message) End Try
Result? The procedure did not end after a timeout. I checked what happens during tracing in the SQL profiler, and it is likely that SQL ends the call in the transaction and should cancel the transaction in timeout.
Note. This test was tested against SQL 2005, but I suspect that the results will be similar in other versions.
brendan
source share