Solved

multiple inserts

Posted on 2002-05-24
2
168 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 200 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 NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 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