select cashier_id,cashier_name,cashier_pw,cashier_grant,cashier_status,discount_rate,num1,num2,other1,other2 from #SDB..t_rm_cashier where #SV <> 'hbyjtv8' and #TV <> 'hbyjtv8'
##
if (#SV = 'hbposv7' or #SV = 'hbposv8' or #SV = 'hbposev8' or #SV = 'hbposev9') and
   (#TV = 'hbposv7' or #TV = 'hbposv8' or #TV = 'hbposev8' or #TV = 'hbposev9')
	begin
	   exec('update t_rm_cashier set branch_no = tab_a.branch_no
			 from #SDB..t_rm_cashier as tab_a
			 where t_rm_cashier.cashier_id = tab_a.cashier_id')
	   exec('update t_rm_cashier set branch_no=isnull(t_bd_branch_info.branch_no,''00'')
			from t_bd_branch_info
			where isnull(t_rm_cashier.branch_no,'''') = '''' and
					t_bd_branch_info.property = ''1'' ')
	end
GO
if (#TV = 'hbyjtv8')
	begin
		exec('insert into t_sys_operator (oper_id ,oper_name ,oper_pw,cash_grant ,cashier_status,discount_rate,num1)
			  select cashier_id,cashier_name,cashier_pw,cashier_grant,cashier_status,discount_rate,num1
			  from #SDB..t_rm_cashier as tab_a
			  where tab_a.cashier_id not in (select oper_id from t_sys_operator)')
		exec('update t_sys_operator set cash_grant = tab_a.cashier_grant,
										cashier_status = tab_a.cashier_status,
										discount_rate = tab_a.discount_rate,
										num1 = tab_a.num1
			  from #SDB..t_rm_cashier as tab_a
			  where t_sys_operator.oper_id = tab_a.cashier_id')
	end

GO
if (#SV = 'hbyjtv8')
	exec('insert into t_rm_cashier (cashier_id,cashier_name,cashier_pw,cashier_grant,cashier_status,discount_rate,num1,num2,other1,other2)
		  select oper_id as cashier_id,oper_name as cashier_name,oper_id as cashier_pw,cash_grant as cashier_grant,cashier_status,discount_rate,0 as num1,0 as num2,'''' as other1,'''' as other2 from #SDB..t_sys_operator ')
GO