select oper_id,item_clsno,data_grant from #SDB..t_sys_data_grant
 where (case when #SV = 'hbposev9' then oper_id else '1' end) <> '1000'
##
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