View Full Version : bulk add DROP TABLE to a sql file.
chetanmadaan
06-07-2010, 05:49 PM
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
djr33
06-07-2010, 09:49 PM
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.
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.
james438
06-08-2010, 03:20 PM
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.
chetanmadaan
06-08-2010, 04:00 PM
James,
thanks for the info. i managed to reexport the DB and checked the option this time.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.