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

sign of corrupt database? Expand / Collapse
Author
Message
Posted Saturday, December 8, 2012 10:58 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, March 13, 2014 2:33 PM
Points: 117, Visits: 315
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?



Post #1394345
Posted Saturday, December 8, 2012 11:47 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 3:21 PM
Points: 42,495, Visits: 35,566
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 2008, MVP
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

Post #1394349
Posted Saturday, December 8, 2012 1:15 PM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, March 13, 2014 2:33 PM
Points: 117, Visits: 315
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.
Post #1394355
Posted Saturday, December 8, 2012 11:00 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:17 AM
Points: 36,800, Visits: 31,261
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1394382
Posted Monday, December 10, 2012 6:36 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, March 13, 2014 2:33 PM
Points: 117, Visits: 315
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.
Post #1394580
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse