Link to home
Start Free TrialLog in
Avatar of ukerandi
ukerandiFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Sql Transaction

Hi
UPDATE rsSalesRecords
SET SalesReansactionDate=NULL
Where SalesPersonID='CCR15200'

COMMIT TRANSACTION;


I need to know if i used Commit Transaction,What will happen

What is the best way to execute above sql with or with out COMMIT TRANSACTION;
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ukerandi

ASKER

after that its unlock the filed or i have write to sql to unlock the fields/Table
this will unlock the filed if not started with Begin Transaction.
Begin Transaction   --- or Begin tran
UPDATE rsSalesRecords
SET SalesReansactionDate=NULL
Where SalesPersonID='CCR15200'   ************* "Lock acquired"

COMMIT TRANSACTION; -- or Commit - or Commit Tran *********** " lock released"

========================================================================================
UPDATE rsSalesRecords
SET SalesReansactionDate=NULL
Where SalesPersonID='CCR15200'   ************* "Lock acquired and automatically released by SQL server"

No need to COMMIT here.