How to run stored procedure 1000 times

Posted by subt13 on Stack Overflow See other posts from Stack Overflow or by subt13
Published on 2010-12-31T21:25:56Z Indexed on 2010/12/31 21:54 UTC
Read the original article Hit count: 146

I have a stored procedure that I'm using to populate a table with about 60 columns. I have genereated 1000 exec statements that look like this:

exec PopulateCVCSTAdvancement 174, 213, 1, 0, 7365
exec PopulateCVCSTAdvancement 174, 214, 1, 0, 7365
exec PopulateCVCSTAdvancement 175, 213, 0, 0, 7365

Each time the stored procedure will be inserting anywhere from 1 to 3,000 records (usually around 2,000 records). The "server" is running desktop hardware with 4 gigs of available memory on a server OS. The problem I have is that after the first 10-15 executes of an average of 1-2 seconds each time, the next 10-15 seem to never finish. Am I doing this correctly? How should I do this?

Thanks! Top 10 waiters:

LAZYWRITER_SLEEP
SQLTRACE_INCREMENTAL_FLUSH_SLEEP
REQUEST_FOR_DEADLOCK_SEARCH
XE_TIMER_EVENT
FT_IFTS_SCHEDULER_IDLE_WAIT
CHECKPOINT_QUEUE
LOGMGR_QUEUE
SLEEP_TASK
BROKER_TO_FLUSH
BROKER_TASK_STOP

© Stack Overflow or respective owner

Related posts about sql

Related posts about stored-procedures