Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

multiple inserts

Posted on 2002-05-24
2
Medium Priority
?
171 Views
Last Modified: 2013-12-24
I'm using cf 5 to run a scheduled task which retrieves a csv. I then parse the csv file and insert records into a database. The problem is that there are about 30,000 entries in the csv which means looping over and doing 30,000 inserts.

Is there a way to insert multiple records in one sql command.

I'm using sql server 7.
0
Comment
Question by:jamathon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Racim BOUDJAKDJI earned 800 total points
ID: 7037180
jamathon,

When running batch processes, your basically make numerous round trips between your Applicative Server (Cold Fusion) and your Data Source (either a database server or a file).  It is an unefficient consumption of bandwith ressources.  

The best way to do what you're asking is to parse all data at once (or break it into 8000 bytes chunks) then let the SQL Server do the looping (and even the reading) for you into one stored procedure.  To do that, you will probably need to familiarize yourself with cursors concepts (they will give you the capability to control more sharply your iteration).  As you have only one round trip between you will be surprised how faster that can be.

Another way to do it may be to a read by SQL Server then attach the data from the CSV if the structure is similar to the table that contains the data.  Hope this helped...

Sincerely,

Racimo
0
 
LVL 2

Author Comment

by:jamathon
ID: 7037679
Thanks,

I got it sorted over the weekend by using the DTS wizard on SQL server, and then used a CF script to call a stored procedure which starts the process.
The 30,000 records where taking 8 minutes, they now take about 8 seconds.

As this is now reolved I'll give u the points

cheers

James
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question