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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:27:11+00:00 2026-06-18T20:27:11+00:00

I have a SQL script that has been causing issues with deadlocks, and I’m

  • 0

I have a SQL script that has been causing issues with deadlocks, and I’m wondering if there is some sort of special lock that is applied when doing a bitwise operation.

The offending query is this:

UPDATE pos.prices SET active = 1 WHERE NOT (Attributes & 1 = 1)

with column types active BIT and Attributes TINYINT.

The reason is that tons of other scripts with updates not including a bitwise AND (&) execute with no issues. This is the only update with this operation and it is deadlocking.

The query it is deadlocking against is a large, periodic select with multiple joins that is grabbing a SCHEMA lock.

Edit: Would this query avoid the table scan?

UPDATE pos.prices SET active = 1 WHERE id in
(SELECT id FROM
(SELECT id, (Attributes & 1) as IsLocked FROM pos.prices) as t1
WHERE NOT IsLocked = 1)
  • 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-06-18T20:27:13+00:00Added an answer on June 18, 2026 at 8:27 pm

    Any operation the does a calculation on a column in the where clause prevents the usage of an index for that column. That leads to a table scan. While a table scan does not necessarily produce deadlocks, it can significantly increase their probability.

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

Sidebar

Related Questions

I have some script that is delivering a series of rows from an SQL
I have a script that I've been using for a some time to easily
I have a SQL script that populates a temp column and then drops the
I have a .sql script file that I want to run once every 24
I have the Execute SQL Script package that contains the script to insert about
I have a noobie question: I need to write SQL script that returns 3
I have a script that connects to SQL Server 2005 default instance. But I'm
I have six SQL queries that I script though R that each take a
I have a php script that backup my table in .sql format and I
I have a complex Powershell script that gets run as part of a SQL

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.