sign of corrupt database?

  • When I manually run this insert script below I'm usually expecting to see (2 lines due to a trigger that posts a log entry):

    (1 row(s) affected)

    (1 row(s) affected)

    However this is what I see:

    (0 row(s) affected)

    (1 row(s) affected)

    (0 row(s) affected)

    (0 row(s) affected)

    (0 row(s) affected)

    (1 row(s) affected)

    (1 row(s) affected)

    INSERT INTO [TrackIT].[dbo].[tblTransactions]

    ([PO_Number]

    ,[Buyer_Initial]

    ,[Quantity]

    ,[Unit_Price]

    ,[Software_Description]

    ,[HeatTicketNumber]

    ,[Transaction_Date]

    ,[Transaction_Type])

    VALUES

    ('3347304',

    'OCC',

    10,

    '479.36',

    'MS Project Std 2010',

    '1939854',

    '12/7/2012',

    'Bulk Purchase')

    GO

    Is this a sign of a corrupted database? This happened just after I manually deleted all records from a table and a few of them gave errors of something like "cannot delete" due to some type of unique key violation... I was able to eventually delete them all but this may have corrupted it? I dropeed and recreated the tables in question and the associated triggers, but still getting these results and the web application I have connected is unable to add records, although one I add a record manually I can modify it from my app so I am getting a connection.

    If the database is corrupt should I script out the entire database and recreate it?

  • briancampbellmcad (12/8/2012)


    Is this a sign of a corrupted database?

    No.

    This happened just after I manually deleted all records from a table and a few of them gave errors of something like "cannot delete" due to some type of unique key violation... I was able to eventually delete them all but this may have corrupted it?

    Nope.

    If the database is corrupt should I script out the entire database and recreate it?

    Well, it's not a sign of corruption anyway, and scripting out a DB is not the way you recover from corruption.

    It looks like either the trigger does more than one operation or the trigger's operations are firing other triggers or there's more than one trigger on the table.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • That makes sense about the number of transactions and those are consistent with the dependent triggers. I dropped them temporarily and recreated them and the number of transactions reponded accordingly. My problem must be on the application side. In Visual Studio I have an ASP.net app that my pages for reading data are working fine and my pages for manipulating data are doing fine as well, but my page for entering data is not. I tried reconfiguring the SqlDataSource and the usual place where I can instruct it to Generate Update, Delete, and Modify statements is strangely grayed out.

  • As a side bar, I recommend adding SET NOCOUNT ON at the beginning of each trigger so that it suppresses all of that unnecessary IO. To wit, sometimes a GUI will interpret such returned row count as an indication of an error.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Could the above be a permissions issue? It is peculiar that in VS my ASP.net SqlDataSource has the "Generate INSERT, DELETE, MODIFY Statements" grayed out... my other tables do not behave like this when attempting a SqlDataSource creation. Some posts have suggested a lack of a Primary Key, but my table has one.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply