SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Updating one database to the structure of another.

    I have multiple databases I use for testing purposes. My ideal structure is my live DB. I've added new tables and fields, etc to it, but haven't had the need to update some of the test DB's to include these new tables and fields. Is there a function/command that will update a non-empty test database to the structure of another (my live db) without overwriting the existing data?

    IE:

    My live database has a table called 'users', with 'firstName','lastName','password','logInDate','logInTime'

    my test database table is identical, minus the 'logInTime' field.

    Is there a way to add that field (and all other tables and updates) in one shot without emptying the DB and not using the ALTER TABLE statement?

    Thanks in advance!

    Jon

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    nope. the other alternative is to rename all of the tables in the test db, create the tables like the live db, then use the insert into [tablename] select... statement to copy all of the rows in to the new tables.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for the quick reply! My problem is that I need to have fake data in the test DB for a demo site, I was just looking to avoid having to recreate the fake data, but it's quicker than ALTERing a bunch of tables I suppose ;-)

    thanks so much!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •