CREATE PROCEDURE st_BakHisDnyStock 
(@FacID int,
 @postDate datetime,@outflag bit output) As 
begin transaction
delete from tableA where FactoryID=@FacID
if @@Error<>0             --@@error值随SQL执行情况而定
begin
  select @outflag=0
  rollback transaction  
end
Insert into tableB (Mcode,Qty) select Mcode,Qty from TableC where 
  postDate=@postDate
if @@Error<>0
begin
  select @outflag=0
  rollback transaction  
end
else
begin
  select @outflag=0
  commit transaction
end
使用Storedproc控件调用该过程:
Storedproc1.parambyname('@FacID').Asinteger:=值;
Storedproc1.parambyname('@postDate').Asinteger:=值;
Storedproc1.execproc;
执行成功判断:
if Storedproc1.parambyname('@outflag').AsBoolean then
   begin
   end;
如此而已