select '' as oper_id from sysobjects with(nolock) where 1=2
##
if not (#SV = 'kmjxc_pro' or #SV = 'kmjxc_std' or #SV = 'bw9kbzpro' or #SV = 'tiger')
	begin
			declare @ls_where varchar(255)
			set @ls_where = '1=1 '
			if #SV = 'hbposev9'
				set @ls_where = ' and oper_id <> ''1000'''
			
			exec('insert into t_sys_data_grant (oper_id,item_clsno,data_grant)
				 select oper_id,item_clsno,data_grant from #SDB..t_sys_data_grant
				 where ' + @ls_where)
	end
go

INSERT INTO t_sys_data_grant(oper_id, item_clsno, data_grant)
select distinct oper_id,item_clsno,'0'
  from t_bd_item_cls,t_sys_operator 
 where len(item_clsno) = isnull((select sys_var_value from t_sys_system where sys_var_id = 'gl_itm_cls_nolen'),2)
   and item_flag = '0'
	and oper_type='ÓÃ»§'
   and oper_id+item_clsno not in (select oper_id+item_clsno from t_sys_data_grant)
GO
