Coast Line
asked on
reading a text file and inserting into database
What is the best possible way to read the text file which has around 10000 records and each column is separated by tab or comma and has 10 columns for every single row
what is the best possible way to do it in coldfusion
what is the best possible way to do it in coldfusion
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Both can be used from ColdFusion. It's no different than any sql command.
If you must parse it manually, there's plenty of examples on parsing CSV files. The logic is exactly the same for tab delimited files.
* Treat it as a list delimited by new chr(10) chr(13)
* As you loop, split each line into columns using list functions, delimiter "," or chr(9)
* Insert the values into the db
https://www.experts-exchange.com/searchResults.jsp?searchTerms=ColdFusion+loop+CSV&searchType=10
If you must parse it manually, there's plenty of examples on parsing CSV files. The logic is exactly the same for tab delimited files.
* Treat it as a list delimited by new chr(10) chr(13)
* As you loop, split each line into columns using list functions, delimiter "," or chr(9)
* Insert the values into the db
https://www.experts-exchange.com/searchResults.jsp?searchTerms=ColdFusion+loop+CSV&searchType=10
ASKER
Thanks Guys, I know parsing of text files but i was acquiring info as to how we can do better in coldfusion like fast processing rather than depending upon list
Well like I said above, the fastest method is let the db do the importing. Both commands can be used in a cfquery. I do it all the time.
ASKER