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.
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.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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").v alue="test "
repeat 2 previous steps for every record
recordset.update
open a recordset using: SELECT TOP 0 * FROM Table1
recordset.add
recordset.fields("name").v
repeat 2 previous steps for every record
recordset.update