forums › forums › SQLyog › Using SQLyog › Row Order On Csv Import
- This topic is empty.
-
AuthorPosts
-
-
October 28, 2006 at 9:38 pm #9998Tony H.Member
Hi all
I'm having some trouble with importing data from a CSV file. Well, actually the data iteself imports just fine, but the order of the rows seems to be totally random. Now MySQL is just fine with the rows of data being in some random order, but unfortunately when I then export that data back out the order IS important. (just as an FYI, I'm sending data back and forth between a MySQL database and a custom in-house application that reads CSV files and processes the data starting from the top).
Is there any way to ensure that SQLyog imports data from a CSV file in order?
Alternatively, is there another easy way to export data and then import it back and make sure that the row order is maintained?
Or, if neither of those options will work, is there a way to export a result set in the order in which it is displayed in SQLyog rather than how it is being stored in the database? When I import my data and the rows are all out of order, I can sort it in SQLyog by just clicking on one of the columns. However if I then make some changes and re-export the data, the rows are exported in the same (dis)order from when they were imported.
Any help would be greatly appreciated!
Tony
ps. SQLyog version is 5.19. MySQL version 5.0.24a.
-
October 30, 2006 at 5:21 am #22872peterlaursenParticipant
when you click the title bar to sort data is affects only how data are displayed.
Actually SQL databases are not designed in a way so that 'raw order' matters. It also depends on the storage Engine (myISAM/InnoD:cool: whether 'unused space' are filled with data or not.
Basically you are supposed to use and ORDER BY clause when generating a result set. You export and import and keep the order you could try
Code:SELECT INTO OUTFILE…. ORDER BY… that will generate a sorted SQL-file. But how the server stores the data when they are stored, SQLyog cannot control!
-
October 30, 2006 at 1:57 pm #22873Tony H.Memberpeterlaursen wrote on Oct 30 2006, 12:21 AM:Basically you are supposed to use and ORDER BY clause when generating a result set. You export and import and keep the order you could tryCode:SELECT INTO OUTFILE
…. ORDER BY… that will generate a sorted SQL-file. But how the server stores the data when they are stored, SQLyog cannot control!
Hi Peter
Thanks for the reply! I hadn't even thought about doing a simple ORDER BY query, but it should work just fine!
Thanks!
Tony
-
-
AuthorPosts
- You must be logged in to reply to this topic.