We have a scenario were sporadically UpdateStatement1 works but UpdateStatement2 and UpdateStatement3 does not execute.
Since stored procedure UpdateDataSP is part of Database transaction Scope, no other process can update the Table1 until this transaction Scope finished. Is this assumption correct? If correct, what can be the scenario because of which the UpdateStatement2 and UpdateStatement3 statement is not executed? Please note the where clause does return the result and no exception happened.
using (var con = new SqlConnection(connectionString))
{
con.Open();
using (var transaction = con.BeginTransaction())
{
UpdateData(con,transaction);
transaction.Commit();
}
}
public void UpdateData(IDbConnection con, IDbTransaction transaction)
{
con.ExecuteScalar("UpdateDataSP", commandTimeout: 3600, transaction: transaction, commandType: CommandType.StoredProcedure);
}
CREATE PROCEDURE [dbo].[UpdateDataSP]
AS
BEGIN
--- UpdateStatement1
UPDATE TABLE1
SET COL1 =''
WHERE ...
--- UpdateStatement2
UPDATE TABLE1
SET COL2 =''
WHERE ...
--- UpdateStatement3
UPDATE TABLE1
SET COL3 =''
WHERE ...
END
Regards,