SQL Server Gurus Please Help Me

Discussion in 'OT Technology' started by FagaBeefe, Jul 3, 2003.

  1. FagaBeefe

    FagaBeefe I live for my initials

    Joined:
    Sep 10, 2002
    Messages:
    1,508
    Likes Received:
    0
    I am running SQL Server 7 and am having a reoccuring problem with the following code.

    select Count(EmployeeID) as EmpCount
    from Employee
    where AgencyID = 5

    This query runs correctly 99% of the time. Then at no particular time all "count" statements cease to work in a particular database table. It continues to not work until I restart SQL Server. Then it works again.

    Any ideas what might cause this?
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Maybe this is a dumb question, but are you sure that it's this specific command (count), and not just SQL server going tits up? I mean what happens if you run the code without the count just before this? In other words, perhaps it's just the dataset that it can't access.
     
  3. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    yeah, that query looks pretty safe. not much to it at all.

    I know it seems dumb, but check your HD available space. If the log file doesn't have a whole lot of room, then it will shit out on you.
     
  4. FagaBeefe

    FagaBeefe I live for my initials

    Joined:
    Sep 10, 2002
    Messages:
    1,508
    Likes Received:
    0
    Thanks for the suggestions, but I just found the problem.

    A process of mine was trying to insert a record into the table via JDBC and it would not commit. It kept trying to do it over and over. That was causing the problems with the table. I moved the SQL to a stored procedure, changed my code and now everything is working.
     

Share This Page