Solved

multiple inserts

Posted on 2002-05-24
2
167 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Restrict IIS Website without Windows login 7 64
Redundant SQL Servers Without Clustering 7 156
Question to locate the problem 18 146
Two wordpress questions 3 107
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 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