How can I rollback an UPDATE query in SQL server 2005?
I need to do this in SQL, not through code.
You can use implicit transactions for this
SET IMPLICIT_TRANSACTIONS ON
update Staff set staff_Name='jas' where staff_id=7
ROLLBACK
As you request-- You can SET this setting ( SET IMPLICIT_TRANSACTIONS ON) from a stored procedure by setting that stored procedure as the start up procedure.
But SET IMPLICIT TRANSACTION ON command is connection specific. So any connection other than the one which running the start up stored procedure will not benefit from the setting you set.