declare @yyyymmddhhmm char(12);--時間 set @yyyymmddhhmm=datename(year,GETDATE())+right('0'+DATENAME(MONTH,GETDATE()),2)+right('0'+DATENAME(DAY,GETDATE()... ...
declare @yyyymmddhhmm char(12);--時間 set @yyyymmddhhmm=datename(year,GETDATE())+right('0'+DATENAME(MONTH,GETDATE()),2)+right('0'+DATENAME(DAY,GETDATE()),2)+right('0'+DATENAME(HOUR,GETDATE()),2)+right('0'+DATENAME(MINUTE,GETDATE()),2) set @O_ErrorCode=0; set @O_ReturnMessage='操作成功'; if @I_OperateType>3 begin set @O_ErrorCode=999; set @O_ReturnMessage='不支持該操作'; return; end begin try begin tran --增加 if @I_OperateType=1 begin select 'add' end --刪除 else if @I_OperateType=2 begin select 'delete' end --更新 else begin select 'update' end commit tran end try begin catch rollback tran end catch