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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Print in SP

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-11-12 : 17:40:45
I've had a habbit of leaving Print statements in SPs for diagnostic reasons. I wonder if there's any feedback on why this isn't a good idea (performance hit>), and whether what I learned today is known by everyone else, or just a few.

After looking everywhere for the following ADO error
objError.Number = 265946 and objerror.NativeError = 0

I finally tracked it down to the Print statement. Whatever is printed is returned in objerror.description, with the above error code. It wasn't so obvious to me all this afternoon.

I opted to modify my error handling routine and leave in the PRINT statements. Bad idea or not?

Sam

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-11-12 : 18:31:55
I would think that PRINT statements cause extra client-server round trips.

IN query Analyzer, turn on "Show Client Statistics" under the query memu at the top. Run a query with the prints, and then without, looking at the "Statistics" tab at the bottom of QA between each statement. Look at the Network and Time statistics.

That should allow you to make the decision to keep them or not.
Me personally, I've NEVER used print in development or production. I would think it would make your code a bit harder to look at and slow things down a very little bit.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-11-12 : 19:02:25
The print statements will fill up the output buffer so you might not be able to see any error messages in things like agent run jobs.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2002-11-12 : 19:55:30
Thanks for the info and thanks.

Sam

Go to Top of Page
   

- Advertisement -