Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL
Author Message
Pmoney
Hangin' Around



Joined: Jan 18, 2006
Posts: 42

PostPosted: Sun Jan 29, 2006 9:17 pm Reply with quote

I am trying to import an SQL text file into MySql.

The file was exported from MySql so all the commands for creating tables and soforth are intact. What I want to do is modify a lot of the data that is comma seperated.

I pulled the file into excel and added the additional rows of data, but I don't know how to export it back to look like an sql text file. Whenever I try to make a comma seperated text file I always get double quotes and format errors.

How do you take data in a spreadsheet and convert it to look like this for example:
Quote:
INSERT INTO `nuke_bbposts` VALUES (5, 1, 6, 1, 1137384076, 'aca2240f', 'John', 1, 1, 1, 0, NULL, 0);
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Jan 30, 2006 7:07 am Reply with quote

Pmoney, You need to have each of the values in its own column (which you probably already have done) and then use one column at the beginning or at the end to use the concatenate function or manually do something like this in the formula cell:

="INSERT INTO `nuke_bbposts` VALUES ("&B1&", "&C1&", ".......etc...&");"

Make sure your string that you just created looks right and then copy the formula down the column for all the rows you need. Once you have this, you can select those strings and paste them into a good text editor, such as Textpad.

If the last copy and paste does not work for you, then you'll have to copy the column of strings again and do a Paste Special --> Values into another sheet within Excel and then you should be able to copy that and paste it into your test editor.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Pmoney







PostPosted: Mon Jan 30, 2006 1:50 pm Reply with quote

Cool, I'm familiar enough with that to make it happen. I just didn't know if there was some type of export that would keep it the way I want.

Thanks, will continue with my update project in this manner!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©