Hi My service is deployed on a few IIS and they execute a considerable number of instances (100-200) of 3-4 different Stored procedures simultaneously. The SPs are executed Via "executescalar".
All SPs are returning different value types. I realized that the values have been replaced for SP calls that are made at same time. I am sure about this because I got invalid cast exception for all calls, and SP logging was correct.
Could somebody tell me what's gone wrong!!!
-Thanks
CREATE PROCEDURE [DBO].[SPO_DATABASESERVER_GET_CONTEXT_FROMNWACCOUNTID_1.0.5]
@NwAccountId BIGINT = NULL,
@ActionFlag VARCHAR(20) = 'NONE'
AS
BEGIN
DECLARE @DBID BIGINT
DECLARE @ConnectionString VARCHAR(250)
IF COALESCE(@NWACCOUNTID,'') != ''
BEGIN
SELECT @DBID = DATABASEID
FROM NWACCOUNTMASTER
WHERE NWACCOUNTMASTERID = @NWACCOUNTID
END
IF (COALESCE(@DBID,'') = '')
BEGIN
RAISERROR ('No DB is assigned for NwAccountId %I64d.',16,1,@NwAccountId)
RETURN
END
IF EXISTS (SELECT 'X'
FROM ACDATABASESERVER
WHERE DATABASEID = @DBID)
BEGIN
SELECT
@ConnectionString = CONNECTIONSTRING
FROM ACDATABASESERVER
WHERE DATABASEID = @DBID
END
IF (COALESCE(@ConnectionString,'') = '')
BEGIN
RAISERROR ('SP failed to fetch ConnectionString for NwAccountId %I64d.',16,1,@NwAccountId)
RETURN
END
SELECT @ConnectionString AS CONNECTIONSTRING
END