Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

When you extract a remote site, the extraction routine pulls out the tables in an order so as to not run into integrity issues. How does it know what order to place into the reload file?

I need to write some routines to pull out data from certain tables, but I also need to reload them in order. I'm hoping there is something in the system tables that can help me accomplish this.


asked 14 May '10, 00:07

Calvin%20Allen's gravatar image

Calvin Allen
accept rate: 25%

Have a look at the WAIT_FOR_COMMIT option... that might make ordering the inserts unnecessary.

(14 May '10, 07:47) Breck Carter

@Breck: However, then one can't use LOAD TABLE as that does an automatic commit...

(14 May '10, 09:55) Volker Barth

AFAIK, the DBXTRACT tool (and DBUNLOAD, too) create and load tables in chronological order, i.e. sorted by *systable.table_id* (and the table_id is used as file name for the unloaded data).

The "not running into integrity issues" feature arises from the fact that FKs are built via "ALTER TABLE t ADD FOREIGN KEY ..." after the load table statements, so that the order of LOADING TABLES is not important at all. (Cf. this question)

However, when you have to extract data in already existing tables with already declared FKs then you should build the order based on FKs. For that, you will have to query the system catalog, primarily table SYSFOREIGNKEY.

permanent link

answered 14 May '10, 09:54

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 May '10, 00:07

question was seen: 2,079 times

last updated: 14 May '10, 09:54