We have a pretty basic interface set up with numerous vendors. We set up a linked server based on their company name. They create a stored procedure on their server that has the correct name and parameters. There are about 20 potential vendors that could be set up, but at any given location there are usually only 5 to 10. We use a single stored proc on our server to call the correct linked server based on the linked server (vendor) name. Our single procedrue looks something like this:
My problem is that I ran a trace and see the following which is taking 13 seconds to run. This is a noticable delay since the users typically see a resonse within a second.
I'm wondering where this is coming from since I never call the procedure with empty parameters like this. Also if I break my one stored procedure into 20 different procedures that each call 1 linked server this seems to go away.
Mike Reigler
Melange Computer Services, Inc
Code:
CREATE PROCEDURE [dbo].[usp_ExecuteRemoteProcedure]
@ServerName VARCHAR(25),
@StringIn VARCHAR(100),
@BoolIn BIT,
@Date1 DATETIME OUTPUT,
@Date2 DATETIME OUTPUT,
@Amount MONEY OUTPUT,
@Int1 INTEGER OUTPUT,
@ErrorCode INTEGER OUTPUT,
@ErrorDesc VARCHAR(100) OUTPUT
AS
IF UPPER(@ServerName) = 'VENDOR1' BEGIN
EXEC VENDOR1...usp_RemoteProcedure
@StringIn,
@BoolIn,
@Date1 OUTPUT,
@Date2 OUTPUT,
@Amount OUTPUT ,
@Int1 OUTPUT ,
@ErrorCode OUTPUT,
@ErrorDesc OUTPUT
END
RETURN
END
IF UPPER(@ServerName) = 'VENDOR2' BEGIN
EXEC VENDOR2...usp_RemoteProcedure
@StringIn,
@BoolIn,
@Date1 OUTPUT,
@Date2 OUTPUT,
@Amount OUTPUT ,
@Int1 OUTPUT ,
@ErrorCode OUTPUT,
@ErrorDesc OUTPUT
END
RETURN
END
IF UPPER(@ServerName) = 'VENDOR3' BEGIN
EXEC VENDOR3...usp_RemoteProcedure
@StringIn,
@BoolIn,
@Date1 OUTPUT,
@Date2 OUTPUT,
@Amount OUTPUT ,
@Int1 OUTPUT ,
@ErrorCode OUTPUT,
@ErrorDesc OUTPUT
END
RETURN
END
GO
My problem is that I ran a trace and see the following which is taking 13 seconds to run. This is a noticable delay since the users typically see a resonse within a second.
Code:
SET FMTONLY ON
EXEC usp_ExecuteRemoteProcedure' ',' ',0,'01-01-1992 01:01:01:000','01-01-1992 01:01:01:000',0,0,0,' '
SET FMTONLY OFF
I'm wondering where this is coming from since I never call the procedure with empty parameters like this. Also if I break my one stored procedure into 20 different procedures that each call 1 linked server this seems to go away.
Mike Reigler
Melange Computer Services, Inc