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

  • SEARCH
  • Home
  • 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 470361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:52:38+00:00 2026-05-12T23:52:38+00:00

I’ve run into an issue that I need clearer heads to think through. Occasionally

  • 0

I’ve run into an issue that I need clearer heads to think through. Occasionally this stored procedure (and many others similar to it):

CREATE PROC [dbo].[add_address1]
    @recno int OUTPUT,
    @clientID int,
    @street varchar (23),
    @city varchar (21),
    @state varchar (2),
    @zip varchar (9)
AS
    declare @s int;
    select @s = updated from is_clientindex where clientid = @clientID
    insert into is_address1
        (original_rec, clientID, street,city,state,zip)
        values (@s + 1, @clientID, @street,@city,@state,@zip);
    set @recno = @@IDENTITY;

Will attempt to insert null into original_rec, a column that doesn’t allow nulls. The table is_clientindex is a very busy table with lots of reads going on. Inserting or updating is rare.

I think what’s happening is that is_clientindex is locked, or in some other way unavailable. This causes the select to fail, eventually leading to the insert failing.

Does it sound like I’m on the right track?

Is there anything I should do to is_clientindex to help this locking issue? The table/database would have been created using the SQL Server 2005 defaults for locking.

Is there anything I should do to this stored procedure?

Unfortunately, I do need to check that updated flag in is_clientindex when inserting into this table. There’s no way around that.

Edits:

  • @ClientID is valid (we know this through debugging), and the is_clientindex table is foreign-keyed to everything else in the system so we know it didn’t vanish.

  • This only happens under heavy load with multiple users.

  • The Activity Monitor shows lots of PAGE locks, but I don’t know on what because the Object ID doesn’t correspond to anything in the sys.all_objects table.

  • 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-12T23:52:38+00:00Added an answer on May 12, 2026 at 11:52 pm

    By default SQL Server ignores errors inside T-SQL blocks and just tries to go on. So it all depends on how you use transactions:

    • If you manage transaction by yourself in T-SQL, you need to detect errors there and do a rollback.

    • If transaction is managed by calling application (either explicitly or by automatic transaction per statement) then, after error is reported to the application, transaction can be rolled back there.

    In SQL Server 2005 or newer use TRY…CATCH block around procedure body to handle the lock timeout error.

    In SQL Server 2000 you should do

    IF @@error <> 0 goto ON_ERROR
    

    or something similar after each statement that could fail. This also works in newer versions but is much more work for errors like lock timeout.

    Setting LOCK_TIMEOUT will not help. If SQL Server detects an actual deadlock (as opposed to long wait on lock) it will raise an error anyway.


    It is still more likely to be a logic error – @s is null after query.
    You can add check and RAISERROR yourself if it happens.
    Just to be sure.
    It’s like assert() in normal programming language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

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.