I've just had a real WTF moment, so I'll try not to be too incoherent...
I have a transaction coded up to do inserts in header/detail tables. I nested everything in a transaction, thinking that if there was a problem, the transaction would rollback and, while it would commit my new data, it would nevertheless leave the
database in a consistent state. But it seems to not have worked...
Here's the transaction:
DECLARE @DeliveryPointID INT = 1,
@TrailerID INT = NULL,
@LoadPercent DECIMAL(8, 4) = 100.0
INSERT INTO dbo.Slips (DeliveryPointID, GrowerContractID, TrailerID, PackRequestID, GrossWeight, LoadPercent, ReceivedDate, VarietyID, Notes)
VALUES (@DeliveryPointID, @ContractID, @TrailerID, @PackRequestID, @GrossWeight, @LoadPercent, @ReceivedDate, @VarietyID, @Notes)
DECLARE @SlipID INT
SELECT @SlipID =
View Complete Post