Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring and debugging large insert statements

Status
Not open for further replies.

spangeman

Programmer
Oct 16, 2004
96
EU
I will be doing a data transfer at some point and I don't want to use DTS for many reasons.

Is there any way of monitoring a large insert statement that may take up to an hour to complete? So you could quickly see that it had only transfered one row after 10 minutes and there was therefore something wrong.

Also if you wait for that hour only to find an extrmely unhelpful error message like - error converting varcahr value ?@?"£?$" to ?"£$@" is there an easy method of finding which row caused the error in the source table?

Cheers
AH
 
When doing a large insert via T/SQL you won't see any rows transfered until the entir batch has completed. Records aren't written one by one.

To find the problem row you'd need to insert row by row using a cursor. Which isn't recommend as it's much slower.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
You could try it via a quick vb app. On error, do a debug.print

Also, run it in query analyzer and it should tell you the number of rows affected before the error i.e. 5263 records affected, 5264 caused your error.
 
What we have done in our company for things like this is find a field that splits the result set quite well (like MatterStatus/OrderStatus).

We then use a cursor to loop through these and then record in a progress table how far we have gotten.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top