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
 General SQL Server Forums
 New to SQL Server Programming
 Calling stored procs asynchronousl y

Author  Topic 

Sean_B
Posting Yak Master

111 Posts

Posted - 2007-07-04 : 06:53:31
Hi,

I've a whole suite of files that I want to load, many of which can be loaded concurrently and some which can only be loaded once other files have already been loaded.

I'm using a seperate Stored Procedure (sp) per file with bulk insert and I'm calling these bulk insert sp's from a controlling sp, what I'd like to do is call several load processes simultaneously from the control sp, and wait till they have all completed before moving on to the next set of files.

I'm about to start investigating using osql to do this, but I would be grateful for any suggestions, useful articles etc that anyone can offer.

Thanks




Sean

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-04 : 07:35:25
in sql itself you can't really do this in trully controllable way.
for truly async processing you should use .net.
look into SqlDataReader Begin* and End* functions.
also look for SqlBulkCopy class:
http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Sean_B
Posting Yak Master

111 Posts

Posted - 2007-07-04 : 08:09:30
Thanks for the advice I will look at this.

Sean
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-04 : 10:51:12
See if this also helps
http://www.nigelrivett.net/SQLTsql/ImportTextFiles.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-07-04 : 12:27:33
also you can do asynchronous stuff in 2005 using service broker.

another possibility is you could create a agent job. calling msdb.dbo.sp_start_job returns immediately so it's another way to do work asynchronously.


elsasoft.org
Go to Top of Page
   

- Advertisement -