Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 fastest way to fill in a table in VB

Author  Topic 

lalbatros
Yak Posting Veteran

69 Posts

Posted - 2007-12-03 : 03:59:29
I would like to accelerate an application if possible.
I am filling a table in VB using about 10000 INSERT sql statements with the "ADO.Connection.Execute" statement. It takes from 30 sec to 60 sec or sometimes 100 sec.

I would like to know if I could accelerate this procedure substantially.

Thanks

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-12-03 : 04:42:52
Yes, run it straight in SQL, I guess you are loading this data from a file?

If so, then bcp or a DTS package will help you greatly.
Go to Top of Page

lalbatros
Yak Posting Veteran

69 Posts

Posted - 2007-12-03 : 10:08:16
No, these data are not loaded from a file.
These data are calculated by a logistic optimisation algorithm.
But I could write the results to a file and upload them after to the database with some DTS package.
Would that be beneficial?

I also used the ADO.Recrodset.AddNew method instead of the Execute(sql) method.
I had various problems with that (shame on me for using reserved keywords as field names).
The error messages suggested me that the AddNew method translates the request into an sql statement.
This and working with other data suggested me that building and executing an sql statement is not less efficient that using the recordset.addnew method.

But ... I still would be interrested to know about the most efficient method.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-12-03 : 10:30:40
look into the SqlBulkCopy Class:
http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server
http://weblogs.sqlteam.com/mladenp/archive/2006/08/26/11368.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -