文件名称:procedure
文件大小:1KB
文件格式:TXT
更新时间:2011-01-26 08:26:06
good
-----------ALTER BY aaaa 20070815
CREATE PROCEDURE CM_Carrier_Business_Logic
@cm_id varchar(50)
AS
begin tran
/*从info中往history搬移数据,首先要判断info中是否有数据,如果有就循环插入到history中*/
declare @omc_name varchar(50)
set @omc_name=substring(@cm_id ,1,charindex('.',@cm_id )-1)
-- Modified by YYS 2006-8-18
declare @cm_id_carrier varchar(50)
select @cm_id_carrier= isnull(max(cm_id),'') from CM_Carrier_New where cm_id like @omc_name +'%'
if @cm_id <> ''
Update CM_Carrier_New set cm_id= @cm_id where cm_id=@cm_id_carrier
-- END YYS
INSERT INTO cm_carrier_history
select * from cm_carrier_info where omc_name = @omc_name
IF @@ERROR <> 0
BEGIN
RAISERROR('数据写入cm_carrier_history表出错,数据搬移终止!',18,1)
rollback transaction
RETURN
END
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
commit transaction
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO