OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

copying database structure [solved]

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
swidler
General User
General User


Joined: 09 Mar 2011
Posts: 9

PostPosted: Wed Feb 15, 2012 12:14 am    Post subject: copying database structure [solved] Reply with quote

i have a database that i want to update with new data. is there a way to create a new db file with all of the structure (including forms and queries) of an old one, but none of the data?

Last edited by swidler on Sun Feb 19, 2012 11:52 am; edited 1 time in total
Back to top
View user's profile Send private message
Arineckaig
OOo Advocate
OOo Advocate


Joined: 01 Mar 2004
Posts: 358

PostPosted: Wed Feb 15, 2012 12:40 am    Post subject: Reply with quote

Make a copy of the .odb file and in the copy delete all the data in the tables or even the tables themselves.
_________________
When this issue has been resolved, it helps other users of the forum if you add the word [Solved] to the Subject line of your 1st post (edit button top right).
OOo 3.4.1 and MySQL on MS Windows XP and Ubuntu
Back to top
View user's profile Send private message
mgroenescheij
Super User
Super User


Joined: 20 Apr 2011
Posts: 870
Location: Australia

PostPosted: Wed Feb 15, 2012 12:42 am    Post subject: Reply with quote

Do you use the embedded database or an external database?
Which database?
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
swidler
General User
General User


Joined: 09 Mar 2011
Posts: 9

PostPosted: Wed Feb 15, 2012 12:54 am    Post subject: Reply with quote

arinekaig--correct me if i'm wrong, but doesn't this screw up the (autoincrement) numbering? i have a vague recollection that once a number is in there, even if the record is erased, the next record uses the next number.
mgroenscheij--what do you mean? it's a simple database, built (or perhaps rebuilt) in base. (originally, i used access, and then i switched over.)
Back to top
View user's profile Send private message
Arineckaig
OOo Advocate
OOo Advocate


Joined: 01 Mar 2004
Posts: 358

PostPosted: Wed Feb 15, 2012 1:29 am    Post subject: Reply with quote

If it is critical that the auto-increment numbering of the clean table should re-start at 0, 1 or whatever there are two potential remedies. The first has general application, the second is often easier to implement but can be tedious.

Either, use Tools>SQL to execute the direct SQL statement:
Code:
ALTER TABLE table ALTER COLUMN column RESTART WITH value

For example:
Code:
Code:
ALTER TABLE "contacts" ALTER COLUMN "id" RESTART WITH 0
.

Alternatively, do not delete initially delate data or the tables in the new .odb file, but in in its table fram copy and paste each table BUT each time in the 'Copy table' dialog make sure the 'Definition' radio button is selected. This creates new empty tables and in each case the auto-increment field should revert to 0. Wherever it does not, simply leave that field out from the field transfer dialog and let Base add its own auto primary key. Only after the new tables have been created can you delete the old and rename the new.
Back to top
View user's profile Send private message
swidler
General User
General User


Joined: 09 Mar 2011
Posts: 9

PostPosted: Wed Feb 15, 2012 1:34 am    Post subject: Reply with quote

since there are only 3 tables, the first one looks great. hope it works. thanks for the help. btw--am i crazy for thinking there should be a built-in function that copies a db's structure?
Back to top
View user's profile Send private message
mgroenescheij
Super User
Super User


Joined: 20 Apr 2011
Posts: 870
Location: Australia

PostPosted: Wed Feb 15, 2012 3:04 am    Post subject: Reply with quote

Hi,

swidler wrote:
mgroenscheij--what do you mean?
What I meant is that with an embedded database (the one that's come with OpenOffice) you can solve it the way Arineckaig described, if it is an external database e.g. MySQL you need an other solution.

Embedded database:
When you copy the odb file you have two base files with each their own database.

External database:
When you copy the odb file you have two base front-ends pointing to the same database.
When you update/delete records from one of the base front-ends, you will see these updates in the other front-end.

Martin
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
swidler
General User
General User


Joined: 09 Mar 2011
Posts: 9

PostPosted: Sun Feb 19, 2012 11:51 am    Post subject: Reply with quote

thanks everyone--this worked fine.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group