SqlTransaction Commit Question

  • Thread starter Thread starter Eugene Banks
  • Start date Start date
E

Eugene Banks

I'm inserting into a table using a stored procedure feeding data from a
CSV file. The stored procedure checks for uniqueness of a social
security number. If the SSN exists, I update the record. Otherwise, I
enter a new record. As a test, I had two rows in my CSV file with the
same SSN. When I first processed the file, the processing of the second
row did not notice that there was a duplicate SSN. After I committed
the transaction, and ran the file again, both rows in the CSV file were
flagged as having duplicate SSNs.

Using a SqlTransaction, is the stored procedure unaware of changes to
the database until a Commit() has been performed? What would explain
this behavior?

Thanks in advance!
 
It should be aware of changes made inside the current transaction. How are
you checking if it exists?

Cole
 
Hi Eugene,

Eugene Banks said:
I'm inserting into a table using a stored procedure feeding data from a
CSV file. The stored procedure checks for uniqueness of a social security
number. If the SSN exists, I update the record. Otherwise, I enter a new
record. As a test, I had two rows in my CSV file with the same SSN. When
I first processed the file, the processing of the second row did not
notice that there was a duplicate SSN. After I committed the transaction,
and ran the file again, both rows in the CSV file were flagged as having
duplicate SSNs.

Using a SqlTransaction, is the stored procedure unaware of changes to the
database until a Commit() has been performed? What would explain this
behavior?

You are inserting records in different transactions perhaps?
Can you show us some code?
 
Back
Top