尝试将表的数据插入到一个临时表中,然后从另一个表中再次插入到相同的临时表中

时间:2013-07-17 18:28:24

标签: sql database-migration

尝试将表的数据插入到一个临时表中并再次插入来自不同表的同一临时表

选择

sfb.SAP_SHIP_TO,sfb.SAP_SOLD_TO,sfb.INVOICE_DATE,fb.MATERIAL_GROUP,sfb.FUEL_GROUP,sfb.INTERFACE_STATUS,sfb.gross_flag,sfb.gross_qty,sfb.net_qty

into 
   #mda_temp_sap_fuel_bdocs
from
  mda_agreement_site sas
join  
  sap_fuel_bdocs sfb 
on
 sas.sap__c = sfb.sap_ship_to
where 

 sfb.Interface_Status = 'SUMMED'/*

* /

-------------------------------------------第二步

Select  
    sfb.SAP_SHIP_TO,
    sfb.SAP_SOLD_TO,
    sfb.INVOICE_DATE,
    sfb.MATERIAL_GROUP,
    sfb.FUEL_GROUP,
    sfb.INTERFACE_STATUS,
    sfb.gross_flag,
    sfb.gross_qty,
    sfb.net_qty

into #mda_temp_sap_fuel_bdocs
from
  mda_agreement_site sas 
join  
  sap_fuel_bdocs_archive sfb 
on
  sas.sap__c = sfb.sap_ship_to 
where 
 sfb.Interface_Status = 'SUMMED'

0 个答案:

没有答案