dbTalk Databases Forums  

Task Moved to Next Step but Yet Incomplete

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Task Moved to Next Step but Yet Incomplete in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jack
 
Posts: n/a

Default Task Moved to Next Step but Yet Incomplete - 11-11-2003 , 01:43 PM






I write a SQL which use cursor to loop and update records.
There are 500 records to be updated. I run the sql in
Query Analyser and it works. Then I place it as one of the
tasks in DTS with transaction and then I run the DTS, it
reported successful. But when I looked at the data, only
about 300 records are updated. It seems that after
updating about 300 records, it suddenly move to the next
task without reporting any problem. This problem can be
replicated after I reboot the machine.

Folks, any idea or suggestion? Thanks...

Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: Task Moved to Next Step but Yet Incomplete - 11-12-2003 , 07:24 AM






There are few things you can try:

1) if possible rid of cursors and take advantage of set processing

2) if cursors are truly needed replace them with pseudo-cursors

3) wrap it all up into a stored procedure

In most of the cases cursors are used they are not necessary. They make the
code less efficient and harder to read and maintain. You can find tons of
articles on the topic.

Ilya



"Jack" <jack (AT) discussions (DOT) microsoft.com> wrote

Quote:
I write a SQL which use cursor to loop and update records.
There are 500 records to be updated. I run the sql in
Query Analyser and it works. Then I place it as one of the
tasks in DTS with transaction and then I run the DTS, it
reported successful. But when I looked at the data, only
about 300 records are updated. It seems that after
updating about 300 records, it suddenly move to the next
task without reporting any problem. This problem can be
replicated after I reboot the machine.

Folks, any idea or suggestion? Thanks...



Reply With Quote
  #3  
Old   
 
Posts: n/a

Default Re: Task Moved to Next Step but Yet Incomplete - 11-12-2003 , 10:07 PM



Thanks a lot, wrapping it to a sproc works!

Quote:
-----Original Message-----
There are few things you can try:

1) if possible rid of cursors and take advantage of set
processing

2) if cursors are truly needed replace them with pseudo-
cursors

3) wrap it all up into a stored procedure

In most of the cases cursors are used they are not
necessary. They make the
code less efficient and harder to read and maintain. You
can find tons of
articles on the topic.

Ilya



"Jack" <jack (AT) discussions (DOT) microsoft.com> wrote in message
news:55b501c3a88c$27006150$7d02280a (AT) phx (DOT) gbl...
I write a SQL which use cursor to loop and update
records.
There are 500 records to be updated. I run the sql in
Query Analyser and it works. Then I place it as one of
the
tasks in DTS with transaction and then I run the DTS, it
reported successful. But when I looked at the data, only
about 300 records are updated. It seems that after
updating about 300 records, it suddenly move to the next
task without reporting any problem. This problem can be
replicated after I reboot the machine.

Folks, any idea or suggestion? Thanks...


.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.