2014年5月30日 星期五

PostgreSQL 把資料表 TABLE 轉到 TEXT 把 TEXT 轉到資料表 TABLE



COPY (SELECT table_name FROM information_schema.tables
WHERE table_name LIKE '%_trl'
  AND table_catalog = 'newtai'
  AND table_schema  = 'adempiere') TO 'C:\newtai\trl.sql'
COPY trl_table FROM 'C:\newtai\trl.sql'

IDEMPIERE轉入中文

update adempiere.AD_Message_Trl t set msgtext = f.msgtext FROM newtai.AD_Message_Trl f WHERE f.AD_Message_ID=t.AD_Message_ID

update adempiere.AD_Table_Trl      t set name = f.name FROM newtai.AD_Table_Trl      f WHERE f.AD_Table_ID     =t.AD_Table_ID
update adempiere.PP_Order_BOM_Trl  t set name = f.name FROM newtai.PP_Order_BOM_Trl  f WHERE f.PP_Order_BOM_ID =t.PP_Order_BOM_ID
--update adempiere.AD_PrintColor_Trl t set name = f.name FROM newtai.AD_PrintColor_Trl f WHERE f.AD_PrintColor_ID=t.AD_PrintColor_ID
--update adempiere.C_Region_Trl      t set name = f.name FROM newtai.C_Region_Trl      f WHERE f.C_Region_ID     =t.C_Region_ID
--update adempiere.M_PriceList_Trl   t set name = f.name FROM newtai.M_PriceList_Trl   f WHERE f.M_PriceList_ID  =t.M_PriceList_ID
update adempiere.AD_Menu_Trl         t set name = f.name FROM newtai.AD_Menu_Trl       f WHERE f.AD_Menu_ID      =t.AD_Menu_ID
update adempiere.AD_Column_Trl       t set name = f.name FROM newtai.AD_Column_Trl     f WHERE f.AD_Column_ID    =t.AD_Column_ID
update adempiere.AD_Ref_List_Trl     t set name = f.name FROM newtai.AD_Ref_List_Trl   f WHERE f.AD_Ref_List_ID  =t.AD_Ref_List_ID
update adempiere.AD_Workbench_Trl    t set name = f.name FROM newtai.AD_Workbench_Trl  f WHERE f.AD_Workbench_ID =t.AD_Workbench_ID
update adempiere.AD_FieldGroup_Trl   t set name = f.name FROM newtai.AD_FieldGroup_Trl f WHERE f.AD_FieldGroup_ID=t.AD_FieldGroup_ID
update adempiere.C_ElementValue_Trl  t set name = f.name FROM newtai.C_ElementValue_Trl f WHERE f.C_ElementValue_ID  =t.C_ElementValue_ID
--update adempiere.GL_Category_Trl     t set name = f.name FROM newtai.GL_Category_Trl   f WHERE f.GL_Category_ID  =t.GL_Category_ID
--update adempiere.M_Product_Category_Trl     t set name = f.name FROM newtai.M_Product_Category_Trl   f WHERE f.M_Product_Category_ID  =t.M_Product_Category_ID
update adempiere.AD_Form_Trl     t set name = f.name FROM newtai.AD_Form_Trl    f WHERE f.AD_Form_ID  =t.AD_Form_ID
update adempiere.C_Tax_Trl       t set name = f.name FROM newtai.C_Tax_Trl      f WHERE f.C_Tax_ID    =t.C_Tax_ID
update adempiere.AD_Desktop_Trl  t set name = f.name FROM newtai.AD_Desktop_Trl f WHERE f.AD_Desktop_ID  =t.AD_Desktop_ID
--update adempiere.AD_Color_Trl     t set name = f.name FROM newtai.AD_Color_Trl   f WHERE f.AD_Color_ID  =t.AD_Color_ID
--update adempiere.AD_PrintLabelLine_Trl     t set name = f.name FROM newtai.AD_PrintLabelLine_Trl   f WHERE f.AD_PrintLabelLine_ID  =t.AD_PrintLabelLine_ID
update adempiere.C_Country_Trl     t set name = f.name FROM newtai.C_Country_Trl   f WHERE f.C_Country_ID  =t.C_Country_ID
update adempiere.AD_Field_Trl      t set name = f.name FROM newtai.AD_Field_Trl   f WHERE f.AD_Field_ID  =t.AD_Field_ID
update adempiere.CM_CStage_Trl      t set name = f.name FROM newtai.CM_CStage_Trl   f WHERE f.CM_CStage_ID  =t.CM_CStage_ID
--update adempiere.W_Store_Trl      t set name = f.name FROM newtai.W_Store_Trl   f WHERE f.W_Store_ID  =t.W_Store_ID
update adempiere.CM_Container_Element_Trl  t set name = f.name FROM newtai.CM_Container_Element_Trl   f WHERE f.CM_Container_Element_ID  =t.CM_Container_Element_ID
update adempiere.AD_InfoColumn_Trl         t set name = f.name FROM newtai.AD_InfoColumn_Trl   f WHERE f.AD_InfoColumn_ID  =t.AD_InfoColumn_ID
update adempiere.R_MailText_Trl            t set name = f.name FROM newtai.R_MailText_Trl      f WHERE f.R_MailText_ID  =t.R_MailText_ID
update adempiere.PP_Order_Workflow_Trl
--update adempiere.C_SalesRegion_Trl  t set name = f.name FROM newtai.C_SalesRegion_Trl   f WHERE f.C_SalesRegion_ID  =t.C_SalesRegion_ID
update adempiere.C_PaymentTerm_Trl  t set name = f.name FROM newtai.C_PaymentTerm_Trl   f WHERE f.C_PaymentTerm_ID  =t.C_PaymentTerm_ID
update adempiere.C_Greeting_Trl     t set name = f.name FROM newtai.C_Greeting_Trl      f WHERE f.C_Greeting_ID     =t.C_Greeting_ID
update adempiere.C_Charge_Trl       t set name = f.name FROM newtai.C_Charge_Trl        f WHERE f.C_Charge_ID       =t.C_Charge_ID
update adempiere.PP_Product_BOMLine_Trl
update adempiere.PP_Product_BOM_Trl
update adempiere.PP_Order_BOMLine_Trl
"PP_Order_Node_Trl"
"AD_Workflow_Trl"
"PA_DashboardContent_Trl"
"C_Campaign_Trl"
"M_Product_Trl"
update adempiere.C_DocType_Trl          t set name = f.name FROM newtai.C_DocType_Trl        f WHERE f.C_DocType_ID       =t.C_DocType_ID
update adempiere.AD_Task_Trl            t set name = f.name FROM newtai.AD_Task_Trl        f WHERE f.AD_Task_ID       =t.AD_Task_ID
update adempiere.AD_Process_Para_Trl    t set name = f.name FROM newtai.AD_Process_Para_Trl        f WHERE f.AD_Process_Para_ID       =t.AD_Process_Para_ID
update adempiere.AD_WF_Node_Trl         t set name = f.name FROM newtai.AD_WF_Node_Trl        f WHERE f.AD_WF_Node_ID       =t.AD_WF_Node_ID
update adempiere.AD_Window_Trl         t set name = f.name FROM newtai.AD_Window_Trl        f WHERE f.AD_Window_ID       =t.AD_Window_ID
"M_PriceList_Version_Trl"
update adempiere.AD_Tab_Trl    t set name = f.name FROM newtai.AD_Tab_Trl        f WHERE f.AD_Tab_ID       =t.AD_Tab_ID
update adempiere.AD_PrintFormatItem_Trl  t set name = f.name FROM newtai.AD_PrintFormatItem_Trl        f WHERE f.AD_PrintFormatItem_ID       =t.AD_PrintFormatItem_ID
update adempiere.C_TaxCategory_Trl    t set name = f.name FROM newtai.C_TaxCategory_Trl        f WHERE f.C_TaxCategory_ID       =t.C_TaxCategory_ID
--update adempiere.C_DunningLevel_Trl    t set name = f.name FROM newtai.C_DunningLevel_Trl        f WHERE f.C_DunningLevel_ID       =t.C_DunningLevel_ID
update adempiere.AD_Reference_Trl  t set name = f.name FROM newtai.AD_Reference_Trl        f WHERE f.AD_Reference_ID       =t.AD_Reference_ID
update adempiere.AD_Process_Trl    t set name = f.name FROM newtai.AD_Process_Trl        f WHERE f.AD_Process_ID       =t.AD_Process_ID
update adempiere.AD_Element_Trl    t set name = f.name FROM newtai.AD_Element_Trl        f WHERE f.AD_Element_ID       =t.AD_Element_ID
"CM_CStage_Element_Trl"
"AD_InfoWindow_Trl"
"CM_Container_Trl"
"W_MailMsg_Trl"
"C_Activity_Trl"
"A_Asset_Group_Trl"
update adempiere.C_Currency_Trl t set name = f.name FROM newtai.C_Currency_Trl   f WHERE f.C_Currency_ID  =t.C_Currency_ID
"C_UOM_Trl"
"AD_BroadcastMessage_Trl"
"AD_CtxHelpMsg_Trl"
"AD_Chart_Trl"
"C_SalesStage_Trl"