Results 1 to 2 of 2

Thread: Rollback based on # of Rows changed

  1. #1
    Tom Guest

    Rollback based on # of Rows changed

    I am trying to create a stored proc that will update exactly one row. Simple. For insurance purposes, I want to create some logic that will rollback the entire transaction if more than one row is updated.

    I know that I could force the primary key into the WHERE clause, but I was looking for some logic that will allow me to bypass that.

    Thanks,
    Tom

  2. #2
    Patrick Guest

    Rollback based on # of Rows changed (reply)

    To avoid the "rollback overhead" and other locks situations, you could check
    before the update, with a select count(*) having the same where as the update would have, if only one or more rows satisfy the where condition. the you update or not.
    Hope this help.
    Patrick



    ------------
    Tom at 7/10/01 3:32:27 PM

    I am trying to create a stored proc that will update exactly one row. Simple. For insurance purposes, I want to create some logic that will rollback the entire transaction if more than one row is updated.

    I know that I could force the primary key into the WHERE clause, but I was looking for some logic that will allow me to bypass that.

    Thanks,
    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •