Results 1 to 8 of 8

Thread: How to rollback my sql query

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Answers
    3

    How to rollback my sql query

    hi,

    any one who know how to rollback the SQL delete statement?
    please reply asap. Urgent. thanks alot.

    from bonnie


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: How to rollback my sql query

    you can simply execute the rollback command before commiting the transaction.


  3. #3
    Junior Member
    Join Date
    Dec 2007
    Answers
    3

    Re: How to rollback my sql query

    but the have another transaction made before i rollback my query. so is it still possible to rollback?? thanks


  4. #4
    Junior Member
    Join Date
    Sep 2007
    Answers
    10

    Re: How to rollback my sql query

    set errorcode to the particular instance of execution and then perform rollback transaction.


  5. #5
    Junior Member
    Join Date
    Dec 2007
    Answers
    3

    Re: How to rollback my sql query

    how to set the error code??
    please advice.
    thanks.


  6. #6
    Junior Member
    Join Date
    Sep 2007
    Answers
    10

    Re: How to rollback my sql query

    declare @errorCode int
    set @errorCode=@@error
    if (-@errorCode<>0)
    begin
    rollback transaction
    end
    commit transaction


  7. #7
    Junior Member
    Join Date
    Jun 2007
    Answers
    5

    Re: How to rollback my sql query

    It is simple..............

    Select * from tablename;

    delete from tablename;

    Rollback;


  8. #8
    Junior Member
    Join Date
    Sep 2008
    Answers
    1

    Re: How to rollback my sql query

    Dear Venugopal,

    We execute the queries

    Select * from tablename;

    delete from tablename;

    Rollback;


    But we are not able to Rollback the data but we get the message "The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION".

    Please resolve this problem


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact