select branch_no,branch_name,property,branch_man,address,zip,branch_email,branch_tel,branch_fax,display_flag,other1,other2,other3,sheet_tag,area,trade_type,com_grant,account,com_init,init_date,indep_bal,dc_no,com_date_up,com_date_down,com_oper_up,com_oper_down,check_flag,check_sheet_no,check_branch_no
from #SDB..t_bd_branch_info
##
if (#SV = 'hbposv7' or #SV = 'hbposv8' or #SV = 'hbposev8' or #SV = 'hbposev9') and
	(#TV = 'hbposv7' or #TV = 'hbposv8' or #TV = 'hbposev8' or #TV = 'hbposev9')
	exec('update t_bd_branch_info set price_type = tab_a.price_type,price_rate = tab_a.price_rate
		from #SDB..t_bd_branch_info as tab_a
		where t_bd_branch_info.branch_no = tab_a.branch_no')
GO
if (#TV = 'hbposv8')
	exec('update t_bd_branch_info set dm_cost = ''1'' where isnull(dm_cost,'''') = ''''')
GO
if (#SV = 'hbposev8' or #SV = 'hbposev9') and
	(#TV = 'hbposev8' or #TV = 'hbposev9')
	exec('update t_bd_branch_info set yh_branch_no = tab_a.yh_branch_no
	from #SDB..t_bd_branch_info as tab_a
	where t_bd_branch_info.branch_no = tab_a.branch_no')
GO