Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Help - Can't query a single table Expand / Collapse
Author
Message
Posted Wednesday, February 20, 2013 10:20 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 5:24 AM
Points: 128, Visits: 490
Hi All,

I have a table in SQL Server 2000 that cannot be queried. Even a simple "select count(*) from dbo_tblAllocations" runs with no end. I've let this query run for 12 minutes with no results returned.

Here's the table:

CREATE TABLE [dbo].[dbo_tblAllocations] (
[IngAllocationsID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[Serial_Nbr] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IngAccountID] [int] NULL ,
[ACCT] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Invoice_Nbr] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Invoice_Date] [smalldatetime] NULL ,
[Process_Date] [smalldatetime] NULL ,
[Records] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[IngSubAccountID] [int] NULL ,
[SUB_ACCT] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[BTN] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[IngVendorID] [int] NOT NULL ,
[Vendor] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[IngLocationsID] [int] NULL ,
[IngNumbersID] [int] NULL ,
[DDN] [nvarchar] (55) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[TYPE] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DESCRIPTION] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[UNIT] [nvarchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Per_Line_Chg] [float] NULL ,
[Line_Chg] [float] NULL ,
[CDR_Chg] [float] NULL ,
[Acct_Per_Line_Chg] [float] NULL ,
[Inv_Total_Chg] [float] NULL ,
[MNTHLY] [float] NULL ,
[OTC] [float] NULL ,
[IBLD] [float] NULL ,
[OBLD] [int] NULL ,
[OUC] [float] NULL ,
[TAX] [float] NULL ,
[LATE] [float] NULL ,
[ADJ] [float] NULL ,
[CM] [int] NULL ,
[UM] [int] NULL ,
[FM] [int] NULL
) ON [PRIMARY]

Here's the indexes on the table:

index_name index_description index_keys
============================================================================
IX_dbo_tblAllocations nonclustered, unique, unique key located on PRIMARY Serial_Nbr
PK_dbo_tblAllocations clustered, unique, primary key located on PRIMARY IngAllocationsID

Here's what I get when I run sp_spaceused on the table:

name rows reserved data index_size unused
============================================================================
dbo_tblAllocations 129669 120112 KB 54432 KB 5624 KB 60056 KB

Does anyone know what could be causing this and how to fix it? From what I can tell it's just this one table and the others look fine.

Thanks,
Mark



Post #1422193
Posted Thursday, February 21, 2013 6:08 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Yesterday @ 1:55 PM
Points: 23, Visits: 366
whats the wait type when you are running the select?

can you do select top 100

are you doing this from the server, or from a client?
Post #1422520
Posted Thursday, February 21, 2013 12:42 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 23, 2013 9:10 AM
Points: 6, Visits: 18
drop the indexes

try a simple select top 10 * from table

rebuild the indexes

or

export, drop and rebuild the table
Post #1422755
Posted Thursday, February 21, 2013 1:07 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 10:04 AM
Points: 961, Visits: 3,008
bdloving 4446 (2/21/2013)
drop the indexes

try a simple select top 10 * from table

rebuild the indexes

or

export, drop and rebuild the table


Don't do this! This is certainly not a first step, and probably not a last step.

Find out what the cause may be.
Can you add a WHERE clause, to filter a single row, and does it return then?
Do you have any open transactions that may be blocking?
Is there some sort of process running that you may not be aware of that can be causing deadlocks?





Michael L John
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Post #1422765
Posted Thursday, February 21, 2013 4:02 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 5:24 AM
Points: 128, Visits: 490
All,

I couldn't query the table regardless of the actual SQL. I tried limiting the return data but that didn't work.

Also tried using DTS to import the table to the same DB in hopes of playing around with the copied table w/o causing any harm to the original. Same results - it hangs.

After I did an sp_who, I noted a user was still connected to the database and this user was set up to perform an import in to this table. That seemed a little coincidental and I later found out the credentials were shared so others were using it. I killed the 2 connections and the problem went away.

Thanks to everyone for the suggestions.

Mark



Post #1422823
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse