Status printing...

  • I have a SP which loops through thousands of records, do some calculations and then insert rows into other tables. Is there anyway where I can set a counter inside the SP of how many records processed and print it with PRINT statement. I'm using a while loop and a PRINT statement inside that, but I get the count printed back only after the batch is completed. I need someway of knowing how many number of records are processed at any given point of time.

    Prasath.

    <a href="mailto:agniputraa@yahoo.com">



    Prasath.

  • Prints are handled when processing is complete. You might try instead

    SELECT @cntvar

    this might work but not tested.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Why do you need to know? So you can show a status bar, allow interruption of processing?

    Andy

  • DBCC OUTPUTBUFFER ( spid )

    will give you a dump of the process's output buffer, i.e. the stuff that hasn't been printed to screen yet.

    The format is not that pleasant, but it is readable and it is useful in a pinch if you want to check on progress.

    It is not however a useful tool to automate status reporting.

    What we need is a T-SQL command to "Flush-Buffer". But I haven't seen one.

  • Antares686's suggestion works. Thanx.

    Prasath.



    Prasath.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply