Validate that Update was successful

What would be the best way to validate that the update statement worked successfully. Kind of like an audit step to make sure that the field was flagged properly. We do reverse audits to see if any records were flagged using reverse logic so the count should come back as 0. Just thinking how to quickly check the PriorityGroupFlag was set properly based on business rules. Thanks! Update Staging Set PriorityGroupFlag = '1_BC' Where (DataGroup65 > 0 or DataGroup66 >0 or DataGroup75 > 1) and PriorityGroupFlag IS NULL

more ▼

asked Apr 11 at 12:17 AM in Default

avatar image

498 11 16 25

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

you can use output clause, create table where you can save records add clause into ten populate this table using insert.yourfield as newvalue, deleted.yourfield as oldvalue and then when you write select statement on that table you can check old value and new value

more ▼

answered Apr 11 at 08:50 AM

avatar image

136 2 2

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Apr 11 at 12:17 AM

Seen: 24 times

Last Updated: Apr 11 at 08:50 AM

Copyright 2018 Redgate Software. Privacy Policy