有关存储过程事务有关问题

有关存储过程事务问题
需求:是将TableA表数据存入到TableB表,然后清空TableA表。
sql语句是:
insert into TableB(col2) select col1 from TableA;
delete from dbo.TableA 

为了安全起见需要用事务判断一下,如果TableA表数据因为异常没有添加到TableB表,那么就不清空TableA。
因为不太会使用事务,所以麻烦请教一下各位。

------解决方案--------------------
begin transaction
insert into TableB(col2) select col1 from TableA;
delete from dbo.TableA  
commit
------解决方案--------------------
探讨
我想在问一下,加上存储过程,是不是也一样使用事务。


引用:
begin transaction
insert into TableB(col2) select col1 from TableA;
delete from dbo.TableA
commit

------解决方案--------------------
begin tran
  insert into TableB(col2) select col1 from TableA;
  IF @@ROWCOUNT ...
  rollback tran;
  else
  commit tran;
  delete from dbo.TableA  
  IF @@ROWCOUNT ...
  rollback tran;
  else
  commit tran;


在存储过程中也可以这样使用.