![]() |
---|
CREATE trigger [dbo].[TR_CUSTOMFORMENTRY_INSERT_UPDATE] on [dbo].[CUSTOMFORMENTRY] after insert, update not for replication as begin set nocount on; update [dbo].[customformentry] set [PAYMENTAMOUNT] = I.EntryData.value('(CustomFormEntry/PaymentAmount/node())[1]', 'money'), [CREDITCARDTYPE] = I.EntryData.value('(CustomFormEntry/CreditCardType/node())[1]', 'nvarchar(100)'), [CARDHOLDERNAME] = I.EntryData.value('(CustomFormEntry/CardHolderName/node())[1]', 'nvarchar(255)'), [CREDITCARDNUMBER] = I.EntryData.value('(CustomFormEntry/CreditCardNumber/node())[1]', 'nvarchar(20)'), [PAYMENTMETHOD] = I.EntryData.value('(CustomFormEntry/PaymentMethod/node())[1]', 'nvarchar(100)'), [PAYMENTDATE] = I.EntryData.value('(CustomFormEntry/PaymentDate/node())[1]', 'datetimeoffset'), [REFERENCENUMBER] = I.EntryData.value('(CustomFormEntry/CreditCardReferenceNumber/node())[1]', 'nvarchar(100)') from INSERTED as I where I.EntryID = [dbo].[customformentry].EntryID --MaryR 06.25.2012 Following call is to cache more info from the xml, primarily for non-common forms. -- There is enough logic in there that I don't want to simply copy the code here, and I don't see a need (currently) -- to update the USP to handle passing in the group of records inserted or updated as the USP is already optimized -- to only act on forms that have not been cached yet or that have recently changed. exec dbo.USP_CUSTOMFORMDASHBOARD_UPDATEFORMENTRYCACHE; end; |