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 6846527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:38:00+00:00 2026-05-27T00:38:00+00:00

EDIT: It turns out that the problem was with an input parm. Apparently, if

  • 0

EDIT: It turns out that the problem was with an input parm. Apparently, if you have an input parm of type INT with a default value of NULL (i.e. @MaxSeqKey int = NULL) and you use that parm in a WHERE clause it can SOMETIMES cause the “hang” issue. What is really weird is that it has been running fine for several months and suddenly broke when SP3 was applied. Since this is part of a batch job we have not run it in test since it was moved to prod. Our test server also has SP3 on it so I ran it in test after I posted this question. Behold! It works fine in test. Go figure. The work around our DBAs found was to DECLARE an internal INT variable in the proc and SET the internal variable equal to the parm. Once again, go figure. Whatever. It works so I wanted to share it with the community.

SQL 10.0.5500 (2008 SP3, NOT 2008R2)

We have a batch job that kicks off a stored proc. The stored proc has the following TSQL in it.

BEGIN TRANSACTION
    UPDATE h
    SET h.PreviousHash = h.CurrentHash
    ,h.CurrentHash = HASHBYTES('SHA1', ISNULL(m.[Name],'') + ISNULL(m.[Address],'') + ISNULL(m.[City],'') + ISNULL(m.[State],'') + ISNULL(m.[Zip],'') )
    FROM [Hash] h 
    INNER JOIN m WITH(NOLOCK) ON m.SequenceKey = h.SequenceKey
    WHERE h.SequenceKey <= @MaxSeqKey


    INSERT INTO [Hash] (SequenceKey, CurrentHash, PreviousHash, Name, [Address], City, Zip)
    SELECT m.SequenceKey
        ,HASHBYTES('SHA1', ISNULL(m.[Name],'') + ISNULL(m.[Address],'') + ISNULL(m.[City],'') + ISNULL(m.[State],'') + ISNULL(m.[Zip],'') )
        ,NULL --PreviousHash - this indicates a "new" record
        ,m.Name
        ,m.[Address]
        ,m.City
        ,m.Zip
    FROM Merchants m WITH(NOLOCK)
    LEFT JOIN [Hash] h ON h.SequenceKey = m.SequenceKey
    WHERE h.SequenceKey IS NULL
    AND m.SequenceKey <= @MaxSeqKey

COMMIT TRANSACTION

This is the first part of the proc. This was running fine every night until they installed SQL 2008 SP3 this past weekend. At first we thought the UPDATE followed by the INSERT to the same table was the problem but we commented out the UPDATE statement and it still got hung up (it doesn’t crash, it just hangs.) We ran the INSERT statement by itself and it runs fine. It seems to only be a problem when run in a stored proc. Since we have other similar statements in stored procs all over our system that just don’t use the HASHBYTES function, we can only assume that this is the problem. I would appreciate it if anyone out there would be willing to take the time to see if they can replicate this.

  • 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-27T00:38:01+00:00Added an answer on May 27, 2026 at 12:38 am

    See my EDIT above. HASHBYTES was not the problem. An input parm of type INT with a default value of NULL was the problem, even after the value was set.

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

Sidebar

Related Questions

EDIT/////// In addition to the helpful advice below, it turns out that another bug
Edit: It turns out I missed something obvious, but I'm going to leave the
I have a txt file that contains data which I need to input to
Edit: From another question I provided an answer that has links to a lot
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
In a rich client CRUD framework I'm working on, I have a so-called edit
I have an Activity that opens the Camera and starts a preview on a
I have an application that uses SmtpClient to send E-Mail, but the E-Mails are
I have a Guid.NewGuid() call that is creating an Empty Guid. What would cause
I have a strange problem: I have a site which has an administration system.

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.