This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Loading CSV file into MY SQL table - Problem in getting Row index from CSV file  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is something related to MYSQL database.

I have a query which loads CSV file from some specified location on the server. query reads all the data and retrieves them to store as individual records in mysql table.
so the number of rows in the csv file will be inserted into the mysql table as same number of records.

My problem (or say requirement) is to get the row id of each csv record. I have to get that row id / Row number / Row Index of that record, save it in my table.
want that row id to match with the corresponding record which gets inserted into the table.
so when I cross check the specific row number in my csv file and the Row id column data in the table, they should match.
Note: Some times row get skipped from inserting into the table

for example :

if i have row id 30 in my csv file having values "Vinay","Hyderabad","India"
My table should contain 30 Vinay Hyderabad India as row values.

How do I do that?
Thanks in advance for your answers....
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch, hope you like it here.

Does it skip rows because it is invalid data? or is it a bug in the insert?
what method are you using for the insert? could you show us that code?

Something to think about for later:
will this table ever contain records from more than 1 csv file, or will it be emptied before every batch insert. as it may be sensible to include the filename in your row, as well as a date maybe.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!