Тема: SQL Ошибка при инсталяции 5.1.0.0
Здравствуйте. При установке тестовой базы данных инсталятор вылетает со следующей ошибкой и таким вот огромным логом. Ругается он, насколько я понимаю на строчку
if( @new_prjfilter_acc_grant>0 or @new_prjfilter_acc_edit>0 ) begin [b]set set[/b] @new_prjfilter_acc_view = 1 end
Система - Windows Server 2008 64 bit, Sql server 2008 64 bit
Вот оно полностью
SQL Server Error: SQL State: 42000, SQL Error Code: 8180 Statement(s) could not be prepared. SQL State: 42000, SQL Error Code: 156 Incorrect syntax near the keyword 'SET'. === CREATE procedure _PRJFILTER_ACCESS_BU_BU @old_prjfilter_id INTEGER output, @old_principal_id INTEGER output, @old_principal_type CHAR(1) output, @new_prjfilter_id INTEGER output, @new_principal_id INTEGER output, @new_principal_type CHAR(1) output, @new_prjfilter_acc_view INTEGER output, @new_prjfilter_acc_edit INTEGER output, @new_prjfilter_acc_grant INTEGER output as begin if ( (@old_prjfilter_id <> @new_prjfilter_id) or (@old_principal_id <> @new_principal_id) or (@old_principal_type <> @new_principal_type) ) exec sp_exception 'exception_not_supported' if( @new_prjfilter_acc_grant>0 or @new_prjfilter_acc_edit>0 ) begin set set @new_prjfilter_acc_view = 1 end end ====== Error On SQL CREATE procedure _PRJFILTER_ACCESS_BU_BU @old_prjfilter_id INTEGER output, @old_principal_id INTEGER output, @old_principal_type CHAR(1) output, @new_prjfilter_id INTEGER output, @new_principal_id INTEGER output, @new_principal_type CHAR(1) output, @new_prjfilter_acc_view INTEGER output, @new_prjfilter_acc_edit INTEGER output, @new_prjfilter_acc_grant INTEGER output as begin if ( (@old_prjfilter_id <> @new_prjfilter_id) or (@old_principal_id <> @new_principal_id) or (@old_principal_type <> @new_principal_type) ) exec sp_exception 'exception_not_supported' if( @new_prjfilter_acc_grant>0 or @new_prjfilter_acc_edit>0 ) begin set set @new_prjfilter_acc_view = 1 end end ========Call Stack .DoIMetadataObjects MS.ExecuteDirect .ExecuteDirect .ExecuteQuery .ExecuteQuery ========Last 10 Succes SQL CREATE procedure _MESURIMENT_BU_BU @old_mesur_id INTEGER output, @new_mesur_id INTEGER output, @new_mesur_note VARCHAR(30) output, @new_mesur_name VARCHAR(100) output, @new_is_weight CHAR(1) output as begin /* Trigger text */ EXEC check_mesur_doc_status @new_mesur_id, 0 end ======= CREATE TRIGGER MESURIMENT_BU ON MESURIMENT INSTEAD OF UPDATE AS begin SET NOCOUNT ON declare @new_mesur_id INTEGER declare @new_mesur_note VARCHAR(30) declare @new_mesur_name VARCHAR(100) declare @new_is_weight CHAR(1) declare @old_mesur_id INTEGER declare @row__count int select @row__count=count(*) from inserted if @row__count>1 begin declare MESURIMENT_BU_Cursor cursor local forward_only static for select i.mesur_id, i.mesur_note, i.mesur_name, i.is_weight from inserted i open MESURIMENT_BU_Cursor fetch next from MESURIMENT_BU_Cursor into @new_mesur_id, @new_mesur_note, @new_mesur_name, @new_is_weight while @@fetch_status = 0 begin select @old_mesur_id = d.mesur_id From deleted d where d.mesur_id = @new_mesur_id goto PROCESS_RECORD NEXT_RECORD: fetch next from MESURIMENT_BU_Cursor into @new_mesur_id, @new_mesur_note, @new_mesur_name, @new_is_weight end close MESURIMENT_BU_Cursor deallocate MESURIMENT_BU_Cursor end else if @row__count = 1 begin select @new_mesur_id = mesur_id, @new_mesur_note = mesur_note, @new_mesur_name = mesur_name, @new_is_weight = is_weight from inserted select @old_mesur_id = mesur_id from deleted goto PROCESS_RECORD end return PROCESS_RECORD: if @@error <> 0 return --<MS BeforeUpdateTrigger> Exec _MESURIMENT_BU_BU @old_mesur_id output, @new_mesur_id output, @new_mesur_note output, @new_mesur_name output, @new_is_weight output if @@error <> 0 return --</MS BeforeUpdateTrigger> --<MS UpdateOperation> UPDATE MESURIMENT SET MESUR_ID = @new_MESUR_ID, MESUR_NOTE = @new_MESUR_NOTE, MESUR_NAME = @new_MESUR_NAME, IS_WEIGHT = @new_IS_WEIGHT WHERE MESURIMENT.mesur_id = @old_mesur_id --</MS UpdateOperation> if @@error <> 0 return -- End of PROCESS_RECORD if @row__count > 1 goto NEXT_RECORD end ======= CREATE procedure _NMK_BU_BU @old_nmk_id INTEGER output, @old_nmk_note VARCHAR(50) output, @old_nmk_name VARCHAR(200) output, @old_nmk_code VARCHAR(30) output, @old_nmk_classif_id INTEGER output, @old_nmk_base_mesur INTEGER output, @old_is_techno CHAR(1) output, @old_is_spec CHAR(1) output, @old_is_connect CHAR(1) output, @old_parcard_id INTEGER output, @old_techcard_id INTEGER output, @old_speccard_id INTEGER output, @old_nmk_classif_type_id SMALLINT output, @new_nmk_id INTEGER output, @new_nmk_note VARCHAR(50) output, @new_nmk_name VARCHAR(200) output, @new_nmk_code VARCHAR(30) output, @new_nmk_classif_id INTEGER output, @new_nmk_base_mesur INTEGER output, @new_is_techno CHAR(1) output, @new_is_spec CHAR(1) output, @new_creator INTEGER output, @new_create_date DATETIME output, @new_changer INTEGER output, @new_change_date DATETIME output, @new_is_connect CHAR(1) output, @new_nmk_udwes FLOAT output, @new_nmk_wesmesur INTEGER output, @new_parcard_id INTEGER output, @new_techcard_id INTEGER output, @new_speccard_id INTEGER output, @new_nmk_classif_type_id SMALLINT output, @new_blcard_id INTEGER output, @new_nmk_notused CHAR(1) output as begin if ((@new_NMK_NOTE is not null) and (@new_NMK_NOTE<>'')) begin if (exists(select nmk_id from nmk where nmk_note=@new_nmk_note and nmk_id<>@new_nmk_id)) exec sp_EXCEPTION 'EXCEPTION_NMK_NOTE_EXISTS'; end if (@new_nmk_classif_id<>@old_nmk_classif_id) if (not exists( select * from nmk_classif where nmk_classif.nmk_classif_id=@new_nmk_classif_id and nmk_classif.nmk_classif_type=@old_nmk_classif_type_id ) ) exec sp_exception 'exception_not_supported'; if ((@new_IS_SPEC=@old_IS_SPEC) and (@new_IS_TECHNO=@old_IS_TECHNO) and (@new_IS_CONNECT=@old_IS_CONNECT) /*and (@new_parcard_id=@old_parcard_id) and (@new_techcard_id=@old_techcard_id) and (@new_speccard_id=@old_speccard_id)*/ ) begin set @new_CHANGER = CAST( USER as INTEGER ); set @new_CHANGE_DATE = GetDate(); if (@new_nmk_note<>@old_nmk_note or ( (@new_nmk_code<>@old_nmk_code) or (@new_nmk_code is null and @old_nmk_code is not null) or (@new_nmk_code is not null and @old_nmk_code is null) ) or ( (@new_nmk_name<>@old_nmk_name) or (@new_nmk_name is null and @old_nmk_name is not null) or (@new_nmk_name is not null and @old_nmk_name is null) ) or @new_nmk_base_mesur<>@old_nmk_base_mesur ) exec CHECK_NMK_PROJECT @new_nmk_id; end if( @new_is_spec<>@old_is_spec and @new_is_spec='F' ) begin if( exists(select * from nmk_pack where nmk_pack.pack_nmk_id=@new_nmk_id) ) set @new_is_spec='T'; end end ======= CREATE TRIGGER NMK_BU ON NMK INSTEAD OF UPDATE AS begin SET NOCOUNT ON declare @new_nmk_id INTEGER declare @new_nmk_note VARCHAR(50) declare @new_nmk_name VARCHAR(200) declare @new_nmk_code VARCHAR(30) declare @new_nmk_classif_id INTEGER declare @new_nmk_base_mesur INTEGER declare @new_is_techno CHAR(1) declare @new_is_spec CHAR(1) declare @new_creator INTEGER declare @new_create_date DATETIME declare @new_changer INTEGER declare @new_change_date DATETIME declare @new_is_connect CHAR(1) declare @new_nmk_udwes FLOAT declare @new_nmk_wesmesur INTEGER declare @new_parcard_id INTEGER declare @new_techcard_id INTEGER declare @new_speccard_id INTEGER declare @new_nmk_classif_type_id SMALLINT declare @new_blcard_id INTEGER declare @new_nmk_notused CHAR(1) declare @old_nmk_id INTEGER declare @old_nmk_note VARCHAR(50) declare @old_nmk_name VARCHAR(200) declare @old_nmk_code VARCHAR(30) declare @old_nmk_classif_id INTEGER declare @old_nmk_base_mesur INTEGER declare @old_is_techno CHAR(1) declare @old_is_spec CHAR(1) declare @old_is_connect CHAR(1) declare @old_parcard_id INTEGER declare @old_techcard_id INTEGER declare @old_speccard_id INTEGER declare @old_nmk_classif_type_id SMALLINT declare @row__count int select @row__count=count(*) from inserted if @row__count>1 begin declare NMK_BU_Cursor cursor local forward_only static for select i.nmk_id, i.nmk_note, i.nmk_name, i.nmk_code, i.nmk_classif_id, i.nmk_base_mesur, i.is_techno, i.is_spec, i.creator, i.create_date, i.changer, i.change_date, i.is_connect, i.nmk_udwes, i.nmk_wesmesur, i.parcard_id, i.techcard_id, i.speccard_id, i.nmk_classif_type_id, i.blcard_id, i.nmk_notused from inserted i open NMK_BU_Cursor fetch next from NMK_BU_Cursor into @new_nmk_id, @new_nmk_note, @new_nmk_name, @new_nmk_code, @new_nmk_classif_id, @new_nmk_base_mesur, @new_is_techno, @new_is_spec, @new_creator, @new_create_date, @new_changer, @new_change_date, @new_is_connect, @new_nmk_udwes, @new_nmk_wesmesur, @new_parcard_id, @new_techcard_id, @new_speccard_id, @new_nmk_classif_type_id, @new_blcard_id, @new_nmk_notused while @@fetch_status = 0 begin select @old_nmk_id = d.nmk_id, @old_nmk_note = d.nmk_note, @old_nmk_name = d.nmk_name, @old_nmk_code = d.nmk_code, @old_nmk_classif_id = d.nmk_classif_id, @old_nmk_base_mesur = d.nmk_base_mesur, @old_is_techno = d.is_techno, @old_is_spec = d.is_spec, @old_is_connect = d.is_connect, @old_parcard_id = d.parcard_id, @old_techcard_id = d.techcard_id, @old_speccard_id = d.speccard_id, @old_nmk_classif_type_id = d.nmk_classif_type_id From deleted d where d.nmk_id = @new_nmk_id goto PROCESS_RECORD NEXT_RECORD: fetch next from NMK_BU_Cursor into @new_nmk_id, @new_nmk_note, @new_nmk_name, @new_nmk_code, @new_nmk_classif_id, @new_nmk_base_mesur, @new_is_techno, @new_is_spec, @new_creator, @new_create_date, @new_changer, @new_change_date, @new_is_connect, @new_nmk_udwes, @new_nmk_wesmesur, @new_parcard_id, @new_techcard_id, @new_speccard_id, @new_nmk_classif_type_id, @new_blcard_id, @new_nmk_notused end close NMK_BU_Cursor deallocate NMK_BU_Cursor end else if @row__count = 1 begin select @new_nmk_id = nmk_id, @new_nmk_note = nmk_note, @new_nmk_name = nmk_name, @new_nmk_code = nmk_code, @new_nmk_classif_id = nmk_classif_id, @new_nmk_base_mesur = nmk_base_mesur, @new_is_techno = is_techno, @new_is_spec = is_spec, @new_creator = creator, @new_create_date = create_date, @new_changer = changer, @new_change_date = change_date, @new_is_connect = is_connect, @new_nmk_udwes = nmk_udwes, @new_nmk_wesmesur = nmk_wesmesur, @new_parcard_id = parcard_id, @new_techcard_id = techcard_id, @new_speccard_id = speccard_id, @new_nmk_classif_type_id = nmk_classif_type_id, @new_blcard_id = blcard_id, @new_nmk_notused = nmk_notused from inserted select @old_nmk_id = nmk_id, @old_nmk_note = nmk_note, @old_nmk_name = nmk_name, @old_nmk_code = nmk_code, @old_nmk_classif_id = nmk_classif_id, @old_nmk_base_mesur = nmk_base_mesur, @old_is_techno = is_techno, @old_is_spec = is_spec, @old_is_connect = is_connect, @old_parcard_id = parcard_id, @old_techcard_id = techcard_id, @old_speccard_id = speccard_id, @old_nmk_classif_type_id = nmk_classif_type_id from deleted goto PROCESS_RECORD end return PROCESS_RECORD: if @@error <> 0 return --<MS BeforeUpdateTrigger> Exec _NMK_BU_BU @old_nmk_id output, @old_nmk_note output, @old_nmk_name output, @old_nmk_code output, @old_nmk_classif_id output, @old_nmk_base_mesur output, @old_is_techno output, @old_is_spec output, @old_is_connect output, @old_parcard_id output, @old_techcard_id output, @old_speccard_id output, @old_nmk_classif_type_id output, @new_nmk_id output, @new_nmk_note output, @new_nmk_name output, @new_nmk_code output, @new_nmk_classif_id output, @new_nmk_base_mesur output, @new_is_techno output, @new_is_spec output, @new_creator output, @new_create_date output, @new_changer output, @new_change_date output, @new_is_connect output, @new_nmk_udwes output, @new_nmk_wesmesur output, @new_parcard_id output, @new_techcard_id output, @new_speccard_id output, @new_nmk_classif_type_id output, @new_blcard_id output, @new_nmk_notused output if @@error <> 0 return --</MS BeforeUpdateTrigger> --<MS UpdateOperation> UPDATE NMK SET NMK_ID = @new_NMK_ID, NMK_NOTE = @new_NMK_NOTE, NMK_NAME = @new_NMK_NAME, NMK_CODE = @new_NMK_CODE, NMK_CLASSIF_ID = @new_NMK_CLASSIF_ID, NMK_BASE_MESUR = @new_NMK_BASE_MESUR, IS_TECHNO = @new_IS_TECHNO, IS_SPEC = @new_IS_SPEC, CREATOR = @new_CREATOR, CREATE_DATE = @new_CREATE_DATE, CHANGER = @new_CHANGER, CHANGE_DATE = @new_CHANGE_DATE, IS_CONNECT = @new_IS_CONNECT, NMK_UDWES = @new_NMK_UDWES, NMK_WESMESUR = @new_NMK_WESMESUR, PARCARD_ID = @new_PARCARD_ID, TECHCARD_ID = @new_TECHCARD_ID, SPECCARD_ID = @new_SPECCARD_ID, NMK_CLASSIF_TYPE_ID = @new_NMK_CLASSIF_TYPE_ID, BLCARD_ID = @new_BLCARD_ID, NMK_NOTUSED = @new_NMK_NOTUSED WHERE NMK.nmk_id = @old_nmk_id --</MS UpdateOperation> if @@error <> 0 return -- End of PROCESS_RECORD if @row__count > 1 goto NEXT_RECORD end ======= CREATE procedure _NMK_PAR_BU_BU @old_nmk_id INTEGER output, @old_par_id INTEGER output, @old_nmk_par_value VARCHAR(50) output, @old_nmk_attach SMALLINT output, @new_nmk_id INTEGER output, @new_par_id INTEGER output, @new_nmk_par_value VARCHAR(50) output, @new_nmk_ref INTEGER output, @new_nmk_attach SMALLINT output, @new_nmk_par_value_d FLOAT output, @new_nmk_par_value_y DATETIME output as begin if( @new_nmk_attach<>@old_nmk_attach) exec sp_exception 'exception_not_supported' --select @new_nmk_par_value_d=par_d, @new_nmk_par_value_y=par_y, @new_nmk_par_value=par_t from get_parameters( @new_par_id, @new_nmk_par_value, @new_nmk_ref ) exec get_parameters @new_par_id, @new_nmk_par_value, @new_nmk_ref, @new_nmk_par_value_d output, @new_nmk_par_value_y output, @new_nmk_par_value output EXEC CHECK_NMK_PROJECT @new_nmk_id /* Trigger Text */ if (@new_nmk_par_value<>@old_nmk_par_value) EXEC ADD_PAR_CASH @new_par_id, @new_nmk_par_value end ======= CREATE procedure _NMK_PAR_BU_AU @old_nmk_id INTEGER output, @old_par_id INTEGER output, @old_nmk_par_value VARCHAR(50) output, @old_nmk_attach SMALLINT output, @new_nmk_id INTEGER output, @new_par_id INTEGER output, @new_nmk_par_value VARCHAR(50) output, @new_nmk_ref INTEGER output, @new_nmk_attach SMALLINT output, @new_nmk_par_value_d FLOAT output, @new_nmk_par_value_y DATETIME output as begin /* Trigger text */ if( @new_par_id<>@old_par_id) begin update par set par.par_stat = par.par_stat + 1 where par_id=@new_par_id update par set par.par_stat = par.par_stat - 1 where par_id=@old_par_id end end ======= CREATE TRIGGER NMK_PAR_BU ON NMK_PAR INSTEAD OF UPDATE AS begin SET NOCOUNT ON declare @new_nmk_id INTEGER declare @new_par_id INTEGER declare @new_nmk_par_value VARCHAR(50) declare @new_nmk_ref INTEGER declare @new_nmk_attach SMALLINT declare @new_nmk_par_value_d FLOAT declare @new_nmk_par_value_y DATETIME declare @old_nmk_id INTEGER declare @old_par_id INTEGER declare @old_nmk_par_value VARCHAR(50) declare @old_nmk_attach SMALLINT declare @row__count int select @row__count=count(*) from inserted if @row__count>1 begin declare NMK_PAR_BU_Cursor cursor local forward_only static for select i.nmk_id, i.par_id, i.nmk_par_value, i.nmk_ref, i.nmk_attach, i.nmk_par_value_d, i.nmk_par_value_y from inserted i open NMK_PAR_BU_Cursor fetch next from NMK_PAR_BU_Cursor into @new_nmk_id, @new_par_id, @new_nmk_par_value, @new_nmk_ref, @new_nmk_attach, @new_nmk_par_value_d, @new_nmk_par_value_y while @@fetch_status = 0 begin select @old_nmk_id = d.nmk_id, @old_par_id = d.par_id, @old_nmk_par_value = d.nmk_par_value, @old_nmk_attach = d.nmk_attach From deleted d where d.nmk_id = @new_nmk_id and d.par_id = @new_par_id goto PROCESS_RECORD NEXT_RECORD: fetch next from NMK_PAR_BU_Cursor into @new_nmk_id, @new_par_id, @new_nmk_par_value, @new_nmk_ref, @new_nmk_attach, @new_nmk_par_value_d, @new_nmk_par_value_y end close NMK_PAR_BU_Cursor deallocate NMK_PAR_BU_Cursor end else if @row__count = 1 begin select @new_nmk_id = nmk_id, @new_par_id = par_id, @new_nmk_par_value = nmk_par_value, @new_nmk_ref = nmk_ref, @new_nmk_attach = nmk_attach, @new_nmk_par_value_d = nmk_par_value_d, @new_nmk_par_value_y = nmk_par_value_y from inserted select @old_nmk_id = nmk_id, @old_par_id = par_id, @old_nmk_par_value = nmk_par_value, @old_nmk_attach = nmk_attach from deleted goto PROCESS_RECORD end return PROCESS_RECORD: if @@error <> 0 return --<MS BeforeUpdateTrigger> Exec _NMK_PAR_BU_BU @old_nmk_id output, @old_par_id output, @old_nmk_par_value output, @old_nmk_attach output, @new_nmk_id output, @new_par_id output, @new_nmk_par_value output, @new_nmk_ref output, @new_nmk_attach output, @new_nmk_par_value_d output, @new_nmk_par_value_y output if @@error <> 0 return --</MS BeforeUpdateTrigger> --<MS UpdateOperation> UPDATE NMK_PAR SET NMK_ID = @new_NMK_ID, PAR_ID = @new_PAR_ID, NMK_PAR_VALUE = @new_NMK_PAR_VALUE, NMK_REF = @new_NMK_REF, NMK_ATTACH = @new_NMK_ATTACH, NMK_PAR_VALUE_D = @new_NMK_PAR_VALUE_D, NMK_PAR_VALUE_Y = @new_NMK_PAR_VALUE_Y WHERE NMK_PAR.nmk_id = @old_nmk_id AND NMK_PAR.par_id = @old_par_id --</MS UpdateOperation> --<MS AfterUpdateTrigger> Exec _NMK_PAR_BU_AU @old_nmk_id output, @old_par_id output, @old_nmk_par_value output, @old_nmk_attach output, @new_nmk_id output, @new_par_id output, @new_nmk_par_value output, @new_nmk_ref output, @new_nmk_attach output, @new_nmk_par_value_d output, @new_nmk_par_value_y output if @@error <> 0 return --</MS AfterUpdateTrigger> if @@error <> 0 return -- End of PROCESS_RECORD if @row__count > 1 goto NEXT_RECORD end ======= CREATE procedure _PAR_BU_BU @old_par_id INTEGER output, @old_par_type CHAR(1) output, @old_par_cash CHAR(1) output, @old_par_unq CHAR(1) output, @new_par_id INTEGER output, @new_par_note VARCHAR(30) output, @new_par_name VARCHAR(100) output, @new_par_type CHAR(1) output, @new_par_attach INTEGER output, @new_par_code VARCHAR(10) output, @new_par_group VARCHAR(10) output, @new_commontree_id INTEGER output, @new_par_cash CHAR(1) output, @new_par_unq CHAR(1) output, @new_par_stat INTEGER output as begin /* Trigger Text */ if (@new_par_type<>@old_par_type) exec sp_exception 'EXCEPTION_NOT_SUPPORTED' if( @new_par_unq='T' ) set @new_par_cash='T' end ======= CREATE procedure _PAR_BU_AU @old_par_id INTEGER output, @old_par_type CHAR(1) output, @old_par_cash CHAR(1) output, @old_par_unq CHAR(1) output, @new_par_id INTEGER output, @new_par_note VARCHAR(30) output, @new_par_name VARCHAR(100) output, @new_par_type CHAR(1) output, @new_par_attach INTEGER output, @new_par_code VARCHAR(10) output, @new_par_group VARCHAR(10) output, @new_commontree_id INTEGER output, @new_par_cash CHAR(1) output, @new_par_unq CHAR(1) output, @new_par_stat INTEGER output as begin /* Trigger text */ if( @new_par_cash<>@old_par_cash or (@new_par_unq<>@old_par_unq and @new_par_unq='T' ) ) begin if (@new_par_cash='T') EXEC CREATE_PAR_CASH @new_par_id, @new_par_unq else delete from par_cash where par_cash.par_id=@new_par_id end end ======= CREATE TRIGGER PAR_BU ON PAR INSTEAD OF UPDATE AS begin SET NOCOUNT ON declare @new_par_id INTEGER declare @new_par_note VARCHAR(30) declare @new_par_name VARCHAR(100) declare @new_par_type CHAR(1) declare @new_par_attach INTEGER declare @new_par_code VARCHAR(10) declare @new_par_group VARCHAR(10) declare @new_commontree_id INTEGER declare @new_par_cash CHAR(1) declare @new_par_unq CHAR(1) declare @new_par_stat INTEGER declare @old_par_id INTEGER declare @old_par_type CHAR(1) declare @old_par_cash CHAR(1) declare @old_par_unq CHAR(1) declare @row__count int select @row__count=count(*) from inserted if @row__count>1 begin declare PAR_BU_Cursor cursor local forward_only static for select i.par_id, i.par_note, i.par_name, i.par_type, i.par_attach, i.par_code, i.par_group, i.commontree_id, i.par_cash, i.par_unq, i.par_stat from inserted i open PAR_BU_Cursor fetch next from PAR_BU_Cursor into @new_par_id, @new_par_note, @new_par_name, @new_par_type, @new_par_attach, @new_par_code, @new_par_group, @new_commontree_id, @new_par_cash, @new_par_unq, @new_par_stat while @@fetch_status = 0 begin select @old_par_id = d.par_id, @old_par_type = d.par_type, @old_par_cash = d.par_cash, @old_par_unq = d.par_unq From deleted d where d.par_id = @new_par_id goto PROCESS_RECORD NEXT_RECORD: fetch next from PAR_BU_Cursor into @new_par_id, @new_par_note, @new_par_name, @new_par_type, @new_par_attach, @new_par_code, @new_par_group, @new_commontree_id, @new_par_cash, @new_par_unq, @new_par_stat end close PAR_BU_Cursor deallocate PAR_BU_Cursor end else if @row__count = 1 begin select @new_par_id = par_id, @new_par_note = par_note, @new_par_name = par_name, @new_par_type = par_type, @new_par_attach = par_attach, @new_par_code = par_code, @new_par_group = par_group, @new_commontree_id = commontree_id, @new_par_cash = par_cash, @new_par_unq = par_unq, @new_par_stat = par_stat from inserted select @old_par_id = par_id, @old_par_type = par_type, @old_par_cash = par_cash, @old_par_unq = par_unq from deleted goto PROCESS_RECORD end return PROCESS_RECORD: if @@error <> 0 return --<MS BeforeUpdateTrigger> Exec _PAR_BU_BU @old_par_id output, @old_par_type output, @old_par_cash output, @old_par_unq output, @new_par_id output, @new_par_note output, @new_par_name output, @new_par_type output, @new_par_attach output, @new_par_code output, @new_par_group output, @new_commontree_id output, @new_par_cash output, @new_par_unq output, @new_par_stat output if @@error <> 0 return --</MS BeforeUpdateTrigger> --<MS UpdateOperation> UPDATE PAR SET PAR_ID = @new_PAR_ID, PAR_NOTE = @new_PAR_NOTE, PAR_NAME = @new_PAR_NAME, PAR_TYPE = @new_PAR_TYPE, PAR_ATTACH = @new_PAR_ATTACH, PAR_CODE = @new_PAR_CODE, PAR_GROUP = @new_PAR_GROUP, COMMONTREE_ID = @new_COMMONTREE_ID, PAR_CASH = @new_PAR_CASH, PAR_UNQ = @new_PAR_UNQ, PAR_STAT = @new_PAR_STAT WHERE PAR.par_id = @old_par_id --</MS UpdateOperation> --<MS AfterUpdateTrigger> Exec _PAR_BU_AU @old_par_id output, @old_par_type output, @old_par_cash output, @old_par_unq output, @new_par_id output, @new_par_note output, @new_par_name output, @new_par_type output, @new_par_attach output, @new_par_code output, @new_par_group output, @new_commontree_id output, @new_par_cash output, @new_par_unq output, @new_par_stat output if @@error <> 0 return --</MS AfterUpdateTrigger> if @@error <> 0 return -- End of PROCESS_RECORD if @row__count > 1 goto NEXT_RECORD end