Link to home
Start Free TrialLog in
Avatar of jgaull
jgaull

asked on

Inserting multiple rows into SQL Server 6.5

What's the fastest way to insert multiple rows into a table in SQL server 6.5?   I cannot write the data to a text file and then bulk copy it in.  Is there something I can do with an ADO recordset?

The fastest way I can think of is to call a separate INSERT statement for each row that needs to be inserted.  It seems like there should be a faster way.
Avatar of sharmon
sharmon

Nothing I know of is going to be faster than just doing the INSERT.  Make sure you are using stored procedures to help speed it up.
Use transaction! It's can extremely speed up your program .

Call Begintrans method of connection object before you call execute method , after you insert hundreds of rows , call committrans method at last.
ASKER CERTIFIED SOLUTION
Avatar of morgan_peat
morgan_peat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm not sure it's the fastest way but you might try it:

open a recordset using: SELECT TOP 0 * FROM Table1

recordset.add

recordset.fields("name").value="test"

repeat 2 previous steps for every record

recordset.update