question

niall5098 avatar image
niall5098 asked

update xml column data

HI THERE, i have been tasked with updating an audir table that contains an xml row. i want to anonymise data where based on like. for example the table structure is as follows: CREATE TABLE [dbo].[TD_AUDIT_V1]( [AUD_ID] [int] IDENTITY(1,1) NOT NULL, [AUD_TABLE_NAME] [nvarchar](50) NOT NULL, [AUD_ROW_ID] [int] NOT NULL, [AUD_ROW_VERSION] [int] NOT NULL, [AUD_CHANGE_TYPE] [char](1) NOT NULL, [AUD_ROW_DATA] [xml] NOT NULL, [AUD_USER_CHANGED] [nvarchar](50) NOT NULL, [AUD_DATE_CHANGED] [datetime] NOT NULL, [AUD_TO_ARCHIVE] [bit] NOT NULL, [AUD_TO_DELETE] [bit] NOT NULL, [AUD_TRAN_ID] [uniqueidentifier] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] The aud_row_data is updated from a trigger when a new row is inserted or updated from another table. i tried to update the data with the following code: update [dbo].[TD_AUDIT_V1] set aud_row_data.modify(' replace value of ( /aud_row_data[APP_IBAN[contains(., "ABCD")] ]/APP_IBAN/text() )[1] with "AB00CDEF00000000000000"'); when i ran the code it updated a number of rows but when i ran select based on the row being like AB00CDEF00000000000000 i got now rows back. has anyone had any previous experience in a task like this? Thanks in advance.
tsqlxmlupdate
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.