SQLImport multiple tables with associations
m ((username removed) (log details removed): Moving to Documentation namespace)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
When importing data with [[Import data from other SQL servers|SQLImport as described here]], you may need to import two or more tables and set up associations between them. For value stores with a limited set of objects, you can do just as with Tab data import and set up Comboboxes for singlelinks in the import grid. This will effectively tie objects together.
<message>Write the content here to display this box</message>
When importing data with [[Training:Import data from other SQL servers|SQLImport as described here]], you may need to import two or more tables and set up associations between them. For value stores with a limited set of objects, you can do just as with Tab data import and set up Comboboxes for singlelinks in the import grid. This will effectively tie objects together.


However, if both tables have a large number of rows, it is not ideal to have one table in a Combobox to choose from. In this case, consider importing enough keys as attributes in your objects - and as a separate step, tie the objects together either with another ServerSIde job - or with an [[OCLOperators sqlpassthrough|SQLPassthrough]] like this:  
However, if both tables have a large number of rows, it is not ideal to have one table in a Combobox to choose from. In this case, consider importing enough keys as attributes in your objects - and as a separate step, tie the objects together either with another ServerSIde job - or with an [[Documentation:OCLOperators sqlpassthrough|SQLPassthrough]] like this:  


  SAPPlantMaterial.sqlpassthrough( 'update SAPPlantMaterial set SAPProfitCenterID=SAPProfitCenter.SAPProfitCenterID   from SAPPlantMaterial join SAPProfitCenter on  SAPProfitCenter.ProfitCenter=SAPPlantMaterial.ProfitCenterKey',  Integer)
  SAPPlantMaterial.sqlpassthrough( 'update SAPPlantMaterial set SAPProfitCenterID=SAPProfitCenter.SAPProfitCenterID   from SAPPlantMaterial join SAPProfitCenter on  SAPProfitCenter.ProfitCenter=SAPPlantMaterial.ProfitCenterKey',  Integer)
Line 7: Line 8:
[[File:2018-11-29 16h19 43.png|none|thumb|268x268px]]
[[File:2018-11-29 16h19 43.png|none|thumb|268x268px]]
[[Category:SQL]]
[[Category:SQL]]
{{Edited|July|12|2025}}

Latest revision as of 04:59, 13 February 2025

This page was created by Hans.karlsen@mdriven.net on 2018-11-29. Last edited by Stephanie@mdriven.net on 2025-02-13.

When importing data with SQLImport as described here, you may need to import two or more tables and set up associations between them. For value stores with a limited set of objects, you can do just as with Tab data import and set up Comboboxes for singlelinks in the import grid. This will effectively tie objects together.

However, if both tables have a large number of rows, it is not ideal to have one table in a Combobox to choose from. In this case, consider importing enough keys as attributes in your objects - and as a separate step, tie the objects together either with another ServerSIde job - or with an SQLPassthrough like this:

SAPPlantMaterial.sqlpassthrough( 'update SAPPlantMaterial set SAPProfitCenterID=SAPProfitCenter.SAPProfitCenterID   from SAPPlantMaterial join SAPProfitCenter on  SAPProfitCenter.ProfitCenter=SAPPlantMaterial.ProfitCenterKey',  Integer)

What this SQL does: Sets the SAPProfitCenterID foreign key in SAPPlantMaterial table to the value of the primary key in SAPProfitCenter for rows where the attribute profitcenter matches profitcenterkey.

2018-11-29 16h19 43.png