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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:46:17+00:00 2026-06-05T22:46:17+00:00

On a SQL Server 2008 R2 database I have a table with a single

  • 0

On a SQL Server 2008 R2 database I have a table with a single integer as a primary key. Sometimes when I perform a select on the primary key I get no results, but if I do a search for all records on the primary key between certain values I am able to retrieve the row. This only affects a few records (less than ten out of millions of rows). The vast majority of records can be selected with a simple “equals” statement.

Does anyone know what could be causing this or how to fix the problem? I suspect something may be wrong with the clustered index. If I use the hint “index(0)” then I can get the record without using a range.

Details:

Statement 1 produces no results:

select * from claim where claim_id = 12166769

Statement 2 produces one result for claim_id 12166769:

select * from claim where claim_id > 12166768 and claim_id < 12166770

Both statements use a Clustered Index Seek using PK_claim_claim_id.

Statement 3 produces one result for claim_id 12166769 using a hint:

select * from claim  with (index(0)) where claim_id = 12166769

The claim table has a column named “claim_id” defined as the primary key, integer, not null. It has a clustered index on the primary key named “PK_claim_claim_id”.

I’m using SQL Sentry Plan Explorer to view the Plan Tree. Statement 1 has 1 Estimated Row and 0 Actual rows. Statement 2 has 7 Estimated rows and 1 Actual row.

Update
Additionally we found that when we ran

select * from claim where claim_id > 12166774 and claim_id < 12166775

we came up five rows returned, 12166770 through 12166774. Running

select * from claim with (index(0))  where claim_id > 12166774 
and claim_id < 12166775

with the hint returned no records as expected.

6/22/2012 Update

I spoke too soon. We found this error in a different spot. I found that I hadn’t actually scanned the entire database, only a portion of it.

select * from claim where claim_id in (8223749,8223752,8223753,8223754,8223755)

returns no rows, while

select * from claim with (index(0))
    where claim_id in (8223749,8223752,8223753,8223754,8223755)

returns rows. I ran

SELECT sys.fn_PhysLocFormatter(%%physloc%%),claim_id FROM claim with (index(0)) 
WHERE claim`_id in (8223749,8223752,8223753,8223754,8223755)

and received

(3:1394868:2)   8223749
(3:1394868:5)   8223752
(3:1394868:6)   8223753
(3:1394868:7)   8223754
(3:1394868:8)   8223755
  • 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-05T22:46:18+00:00Added an answer on June 5, 2026 at 10:46 pm

    Since my comment seemed to fix the problem I will go ahead and post as an answer.

    DBCC CHECKTABLE ( table_name | view_name [ , { NOINDEX | index_id } |, { REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD } ] )

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

Sidebar

Related Questions

I have this table structure on a SQL Server 2008 R2 database: CREATE TABLE
I have an SQL Server 2008 database with a table that has a column
I have got a table in an SQL Server 2008 R2 database. It contains
I have a table like this in my database (SQL Server 2008) ID Type
I have a database in SQL Server 2008 and one particular table has information
I have a database table in Sql Server 2008 R2 which contains data stored
I have renamed a table in a SQL Server 2008 database, from eL_CourseStepUserNotes to
I have a SQL Server 2008 database and a nvarchar(256) field of a table.
I have a SQL Server 2008 database. There is a table called Documents with
In a SQL Server 2008 database I have a table with a Date field

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.