Hello, Looking into why a given process has a tendency to deadlock, where I found code that made me wonder. Would the following cause any problems. Basically since the table that the called stored procedure is populated in the calling stored procedure would this create a problem. Note, I did not write the actual code and the example leave a lot out.
-- from first stored procedure DECLARE @BatchID int, @sp varchar(50) = 'usp_whatever'; -- table populated insert into Eval.dbo.EvalBatchHeader ( BatchDate, PlanID, Client , StatusList, Operator, Workstation, IsLive) values ( GETDATE(), 7, 'Client1', 'Status,List', 'Me', 'MyWS', 1); -- SET @BatchID = @@IDENTITY; -- EXECUTE @sp @BatchID; GO -- called stored procedure CREATE PROCEDURE usp_whatever (@BatchID INT) AS DECLARE @PlanID int, @Client varchar(10); -- table called SELECT @PlanID = PlanID, @Client = Client FROM Eval.dbo.EvalBatchHeader WHERE BatchID = @BatchID; GO