SQL Queries for Creating a rollback point and to rollback to that specific point
Posted
by Santhosha
on Stack Overflow
See other posts from Stack Overflow
or by Santhosha
Published on 2010-04-15T07:48:14Z
Indexed on
2010/04/15
7:53 UTC
Read the original article
Hit count: 465
Hi,
As per my project requirement i want to perform two operation
- Password Change
- Unlock Account(Only unlocking account, no password change!)
I want return success only if both the transactions succeeds. Say if password change succeeds and unlock fails i cannot send success or failure. So i want to create a rollback point before password change, if both queries executes successfully i will commit the transaction. If one of the query fails i will discard the changes by rolling back to the rollback point. I am doing this in C++ using ADO. Is there any SQL Queries,using i can create the rollback point and reverting to rollback point and commiting the transaction
I am using below commands for Password change
ALTER LOGIN [username] WITH PASSWORD = N'password'
for Unlock account
ALTER LOGIN [%s] WITH CHECK_POLICY = OFF
ALTER LOGIN [%s] WITH CHECK_POLICY = ON
Thanks in advance!!
Santhosh
© Stack Overflow or respective owner