Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1080375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:01:13+00:00 2026-05-16T22:01:13+00:00

My service is deployed on a few IIS and they execute a considerable number

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:01:14+00:00Added an answer on May 16, 2026 at 10:01 pm

    “invalid cast exception” is not a SQL error…

    Do you have different web code that expects different return types for the same stored proc?

    It’s impossible for SQL to have mixed or changing different return datatypes if every IIS calls the same server/database/stored proc and the stored proc has the same outout signature. The only causes could be:

    • different databases
    • different SQL Servers
    • stored procedures have IF SELECT int, varchar... ELSE SELECT varchar, int...
    • dynamic SQL
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RESTful web service deployed at http://example.com/v1/SomeResource . One day, a new
We have a C# service that is deployed to a remote customer system. The
I have deployed ASP.NET web site and ASP.NET web service on the same web
We're testing our ClickOnce deployed application internally on IIS (Internet Information Services), but we're
I made a simple web service which worked nice with few systems that it
I have created a Web Service and deployed it on an internal server here.
My team has a service deployed internally, and part of this service is a
I have a web service deployed and ready to use. The client application is
Service Oriented Architecture seems to be more and more of a hot quote these
Add service reference to Amazon service fails, saying Could not load file or assembly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.