Dear netters,
I have a stored procedure LoadData that is responsible for loading data from one table to another. Procedure calls for logging of errors/instrumentation regardless of whether the load is successful or not. To implement this type of logging, we defined a linked server (loopback onto the same SQL server 2012, on which the main procedure is running).
EXEC master.dbo.sp_addlinkedserver @server = N'loopback', @srvproduct=N' ', @provider=N'SQLNCLI', @datasrc=N'DEV', @catalog=N'test'
Here is the section of the
LoadData stored proc that initiates an instrumentation call:
exec loopback..dbo.LogProcedureStart @i_ProcedureName = @v_ProcedureName ,@o_id = @v_LogFk output ;
Procedure works fine. We run it many times in sequence, for different source tables, and wanted to experiment with performance when running it in parallel instead. We implemented a service broker to handle asynchronous procedure executions. Using an example from Asynchronous Procedure
We got the sample procedure executing fine, but when we went to switch it for the LoadData procedure, the proc simply does not get called (or something is off). The call shows as "CONVERSING" in the queue, and nothing is happening.
Pulling sections of code showed that when "loopback.." is used, LoadData stored procedure does not work. When "loopback.." is removed, all is fine.
Given that we do need the logging/instrumentation to be in place regardless of whether the stored procedure is executed asynchronously or not, what can be done to resolve this issue?
Thank you in advance!
--Alex