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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PRINT stmts in stored procedures?

Status
Not open for further replies.

sqlcasey

Programmer
Sep 21, 2006
150
US
Hi,

I have a question about PRINT statements - sometimes developers here overlook removing their PRINT statements from the stored procedures they write - what is the effect, if any, of these PRINT statements?

Most of the sp's the write are called from applications, so the end user would never see the PRINT output.

Thanx
 
Just my two cents, but I think they are occasionally useful for debugging in Query Analyzer.

Alex


It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
We had problems early on leaving PRINTs active - filled up logfiles & degraded performance. I usually comment them out until needed....

I have great faith in fools; self-confidence my friends call it.
-Poe
 
In SQL 2005 leaving in the print statements can cause problems depending on how you are calling the stored procedure.

If you have a stored procedure with a print statement, then a select statement SQL 2005 will return a null record set along with the print statement then the recordset with your data.

I've seen it do this with ADO via ASP as well as a .NET application using ADO to connect.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top