Results 1 to 5 of 5

Thread: bulk add DROP TABLE to a sql file.

  1. #1
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default bulk add DROP TABLE to a sql file.

    guys,

    i need some help... i exported around 45MB of files and now the server is gone..

    the problem i never user the option Add DROP TABLE / VIEW / PROCEDURE / FUNCTION

    and now i badly need it... the problem is i can't export it again... but if there is a software/phpscript available which can do this for me... that will be great.

    thanks in advance

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hm? Drop table removes tables. I believe you need Create table in this case.
    What you need to do is recreate the database table by table, then insert the data. Look through the various columns and figure out their types, then create the tables for this. Then your query should work. There is no automated way that I know of, nor is this necessarily going to be easy, or predictable (is it a 'big int' or just 'int'?) but you can probably get it working. You missed the opportunity to actually back this up, so now all you can do is guess. Sorry there isn't a better solution.
    Do you have any old backups? Perhaps in those you could borrow the "Create table" queries.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    have you ever used (and does your server have installed -most do-) phpmysql? It's quite easy to use once you get the hang of it.

    But as djr says, if you don't know the database structure (table names, field names, types, keys, etc.)... well, that is the hard part.

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I could be misunderstanding, but it sounds like chetanmadaan exported his database without checking the add/drop table option. His server is now gone. Does he mean database? I'm going to assume that he has access to the phpmyadmin since he says he never used the Add DROP TABLE / VIEW / PROCEDURE / FUNCTION, which I have forgotten to do myself now and again and is a phpmyadmin option. Actually, I didn't even know I needed to do that, because I was still learning some of the very basics of how databases work.

    Try to manually DROP (not ADD) all of the tables that you exported by going into your phpmysql program and check off all of the tables you are trying to import and drop them. After doing that the sql should be able to be imported to the database with little problem. I just wish I knew what he meant as far as the server being gone. If the database is gone then he'll need to recreate a database and give it the same name.

    From what I can tell the table structure is already in his exported sql file at least. I just don't see any reason for him to need to recreate the table structure anywhere or if he does need to recreate the table structure somewhere then he, well, no I just don't see a reason he would need to recreate the table although it may still be possible that he needs to do that. I have not run into that situation yet though.
    Last edited by james438; 06-13-2010 at 08:45 PM.
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #5
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    James,

    thanks for the info. i managed to reexport the DB and checked the option this time.

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
  •