请帮我看下我写的这个存储过程哪里有错。。。谢谢
就是同时插入两个表的 
 create   PROCEDURE   Stored_Procedure_Name                  
                         @ChargeUpDateId   uniqueidentifier   =   NEWID()   , 
                         @year   int, 
                         @Month   int, 
                         @ChargeUpDate   datetime, 
                         @CompanyCode   varchar(20),                           
                         @PostingDateID   uniqueidentifier   =   NEWID(), 
                         @PostingDate      datetime                          
 AS   transaction 
 INSERT   INTO   ChargeUpDate(ChargeUpDateId,Year,Month,ChargeUpDate,CompanyCode)values(@ChargeUpDateId,@year,@Month,@ChargeUpDate,@CompanyCode) 
    if         @@error <> 0                
       begin          
                   print          'insert         into         ChargeUpDate         Failure '          
                   goto         pro                           
 insert   into      PostingDate(PostingDateID,ChargeUpDateID,PostingDate)values(newid(),@ChargeUpDateId,@PostingDate) 
       if         @@error <> 0                
       begin          
                   print          'insert         into         PostingDate         Failure '          
                   goto         pro                           
 commit   transaction 
 return         0       
 pro:    
 rollback         transaction          
 return         1    
 Go   
 谢谢啊
------解决方案--------------------  create PROCEDURE Stored_Procedure_Name   
 @ChargeUpDateId uniqueidentifier = NEWID() , 
 @year int, 
 @Month int, 
 @ChargeUpDate datetime, 
 @CompanyCode varchar(20),   
 @PostingDateID uniqueidentifier = NEWID(), 
 @PostingDate datetime     
 --AS transaction 
 AS--笔误!!!刚才漏了一个AS 
 begin transaction   
 INSERT INTO ChargeUpDate(ChargeUpDateId,Year,Month,ChargeUpDate,CompanyCode)values(@ChargeUpDateId,@year,@Month,@ChargeUpDate,@CompanyCode) 
 if @@error <> 0 
 --begin 
 print  'insert into ChargeUpDate Failure ' 
 --goto pro   
 insert into PostingDate(PostingDateID,ChargeUpDateID,PostingDate)values(newid(),@ChargeUpDateId,@PostingDate) 
 if @@error <> 0 
 --begin 
 print  'insert into PostingDate Failure ' 
 --goto pro   
 if @@error=0 
 begin 
 commit transaction 
 return 0 
 end 
 else 
 begin 
 --pro: 
 rollback transaction 
 return 1 
 end 
 Go
------解决方案--------------------    就是同时插入两个表的