question

red68 avatar image
red68 asked

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
sql-server-
10 |1200

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

1 Answer

·
Lukasz8519 avatar image
Lukasz8519 answered
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
10 |1200

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

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.