Friday, March 30, 2012

Help on Updategram

I am recieveing this error.
"Ambiguous delete, unique identifier required
Transaction aborted"
I am trying to delete several rows where a column equals
a certain value like "7". THe errors occurs because
SQLXML appears to only allow from a single row to be
deleted at a time. Here is what the Profiler shows:
SET XACT_ABORT ON
BEGIN TRAN
DECLARE @.eip INT, @.r__ int, @.e__ int
SET @.eip = 0
DELETE tblNote WHERE ( pkAccountID=6 ) ; SELECT @.e__ =
@.@.ERROR, @.r__ = @.@.ROWCOUNT
IF (@.e__ != 0 OR @.r__ != 1) SET @.eip = 1
IF (@.r__ > 1) RAISERROR ( N'SQLOLEDB Error Description:
Ambiguous delete, unique identifier required Transaction
aborted ', 16, 1)
ELSE IF (@.r__ < 1) RAISERROR ( N'SQLOLEDB Error
Description: Empty delete, no deletable rows found
Transaction aborted ', 16, 1)
IF (@.eip != 0) ROLLBACK ELSE COMMIT
SET XACT_ABORT OFF
WHY?!?!?!?!?!?!
Regards,
Ron
To delete multiple rows in an Updategram, you have to specify each row to be
deleted individually in the "before" element - there's no equivalent of a
wildcard delete.
From SQLXML 3.0 BOL:
"If an element that is specified in the updategram either matches more than
one row in the table or does not match any table row, the updategram returns
an error and cancels the entire <sync> block. Only one record at a time can
be deleted by an element in the updategram."
Hope that helps,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"Ron Antinori" <rantinori@.bluestoneinfo.com> wrote in message
news:264601c48e1c$9a727f80$a301280a@.phx.gbl...
I am recieveing this error.
"Ambiguous delete, unique identifier required
Transaction aborted"
I am trying to delete several rows where a column equals
a certain value like "7". THe errors occurs because
SQLXML appears to only allow from a single row to be
deleted at a time. Here is what the Profiler shows:
SET XACT_ABORT ON
BEGIN TRAN
DECLARE @.eip INT, @.r__ int, @.e__ int
SET @.eip = 0
DELETE tblNote WHERE ( pkAccountID=6 ) ; SELECT @.e__ =
@.@.ERROR, @.r__ = @.@.ROWCOUNT
IF (@.e__ != 0 OR @.r__ != 1) SET @.eip = 1
IF (@.r__ > 1) RAISERROR ( N'SQLOLEDB Error Description:
Ambiguous delete, unique identifier required Transaction
aborted ', 16, 1)
ELSE IF (@.r__ < 1) RAISERROR ( N'SQLOLEDB Error
Description: Empty delete, no deletable rows found
Transaction aborted ', 16, 1)
IF (@.eip != 0) ROLLBACK ELSE COMMIT
SET XACT_ABORT OFF
WHY?!?!?!?!?!?!
Regards,
Ron

No comments:

Post a Comment