Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATA LOAD - using the column_list

Status
Not open for further replies.

drmaves

Programmer
Jun 20, 2002
12
0
0
US
Is there a way to skip columns when using the column_list attribute of DATA LOAD?

For example, if I wanted ignore the fourth column in the data file I'm trying to load how would I do it?

I tried the following but MySQL would not accept it:

(area,status,property_type,listing_num,,agent_id)

 
Where were you using the column list in the query? MySQL requires that you use it at the end.

Also, if you're skipping a column, don't use a blank column name between commas, as you have here:

(area,status,property_type,listing_num,,agent_id)

Simply don't mention the column name:

(area,status,property_type,listing_num,agent_id)


Keep in mind that the column-list tells MySQL with which column to associate the data in the file. You don't have the specify the columns of a table in order -- the clause exists to populate a table where, like in your case, you are not populating a column or when the order of the data in the file does not match the order of the columns in the table.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
The column I want to skip is in the data file not in the table. As I understand it the order in the column_list is directly related to the order of the columns in the data file. So how do I skip over, for example, the fourth column in the data file?

 
One way would be to alter the table to add a column into which that data will go. Then alter the table a second time after importing the data to remove that column.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top