Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Transaction integrity question

Author  Topic 

pontifikas
Starting Member

32 Posts

Posted - 2005-07-04 : 06:17:34
Is it possible, when a remote client is trying to store multiple rows of data to an SQL server, that the transaction fails at some point but no rollback occurs.

I'm having the following problem.
From a batch of rows(say 50)(generated withing an OledbTransaction) sent for store to a DB, only the first 30 are stored and the last 19. The 31st row dissappears.

The remote client is connected to the server via a DSL dedicated line.

Is this possible to occur or should I blame something else?

Kristen
Test

22859 Posts

Posted - 2005-07-04 : 09:58:28
I expect you would have to detect that there was an error and rollback yourself. In simplistic terms that might look like:

BEGIN TRANSACTION
INSERT INTO MyTable ... somestuff ...
IF @@ERROR<>0 OR @@ROWCOUNT<>1 GOTO DoRollback
... more inserts and error checking etc. ...
COMMIT
GOTO AllDone

DoRollback:
ROLLBACK
-- Report to client application that an error occurred

AllDone:

Kristen
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-04 : 21:24:55
yes that is possible especially if you're not using SPs or UDFs and directly issuing tsql from your application

quote:
Originally posted by pontifikas

Is it possible, when a remote client is trying to store multiple rows of data to an SQL server, that the transaction fails at some point but no rollback occurs.
dedicated line.

Is this possible to occur or should I blame something else?



--------------------
keeping it simple...
Go to Top of Page

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2005-07-05 : 02:05:18
If the entire set (50 records) are inserted WITH-IN ONE transaction, you should look to blame something else.

If the client is inserting each record by itself (without explicitly defining a transaction before inserting the first record and keeping it open until the last record), then it is quite possible.

Either way, normal error-handling routines on the client program can trap these errors...

Hemanth Gorijala
I Came. I Saw. I Normalized.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-07-05 : 03:58:49
Might there be a trigger which is "deleting" the inserted row for some data validation reason?, or even an INSTEAD OF trigger which is just not inserting it?

Kristen
Go to Top of Page
   

- Advertisement -