Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Re: Getting tab...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 10 Topic 3695 of 3876
Post > Topic >>

Re: Getting tables in insertion order

by Silvio Bierman <sbierman@[EMAIL PROTECTED] > Apr 2, 2008 at 01:45 PM

Sankar wrote:
> Hi,
>   I am new to Database..I donot want insertion order of rows or
> records.. I need insertion order of tables..
> 
> Consider if i am migrating from sourceDB to targetDB..through
> programatically
> 
> First i will create DB and all tables in the targetDB..
> 
> Then I have to move all the datas from sourceDB to targetDB... Here
> for moving i need insertion order of tables(to take care of forign key
> violations .. parent tables first thn child tables)
> 
> regards
> Sankar R
> 
> On Apr 2, 2:08 am, Roedy Green <see_webs...@[EMAIL PROTECTED]
>
> wrote:
>> On Tue, 01 Apr 2008 13:44:50 GMT, Roedy Green
>> <see_webs...@[EMAIL PROTECTED]
> wrote, quoted or indirectly quoted
>> someone who said :
>>
>>> What is "insertion" order?
>> In SQL, if the order rows are inserted in im****tant, you must add a
>> field to the record that you increment on each insertion or mark with
>> a timestamp.  Then of course you use a perfectly ordinary ORDER BY on
>> the field to retrieve in that order.
>>
>> The autoincrement functions should be much faster than ones you
>> implement longhand.  Back in the olden days of Codasyl databases, I
>> discovered incrementing these counters was what took the majority of
>> database activity.
>> --
>>
>> Roedy Green Canadian Mind Products
>> The Java Glossaryhttp://mindprod.com
> 

You are going at it in the wrong way. You should do this as:

1) Create all new tables without foreign-key constraints
2) Copy all data from the source to the new tables
3) Create the referential constraints

This process is independent of table ordering.

It is not generally possible to define a table ordering where checks and 
referential constraints will always be satisfied during table-by-table 
insertions. If you can do that for your particular database (you seem to 
  because you create the new tables in some specified order) then simply 
remember the order in which you created them so you can populate the 
tables in the same order.

Regards,

Silvio
 




 10 Posts in Topic:
Getting tables in insertion order
Sankar <pr.sankar@[EMA  2008-04-01 00:45:28 
Re: Getting tables in insertion order
Lew <lew@[EMAIL PROTEC  2008-04-01 07:33:38 
Re: Getting tables in insertion order
Sabine Dinis Blochberger   2008-04-01 12:54:21 
Re: Getting tables in insertion order
Dyreatnews@[EMAIL PROTECT  2008-04-01 14:16:04 
Re: Getting tables in insertion order
Roedy Green <see_websi  2008-04-01 13:44:50 
Re: Getting tables in insertion order
Roedy Green <see_websi  2008-04-01 21:08:26 
Re: Getting tables in insertion order
Sankar <pr.sankar@[EMA  2008-04-02 04:25:01 
Re: Getting tables in insertion order
Silvio Bierman <sbierm  2008-04-02 13:45:34 
Re: Getting tables in insertion order
Roedy Green <see_websi  2008-04-03 08:45:20 
Re: Getting tables in insertion order
blueparty <partner5044  2008-04-04 07:39:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 23:36:46 CST 2008.