Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
T-SQL (SS2K5)
»
Disable print in a stored procedure - TSQL -...
Disable print in a stored procedure - TSQL - Example: Print 'This is my result'
Rate Topic
Display Mode
Topic Options
Author
Message
Robert Cearley
Robert Cearley
Posted Wednesday, January 30, 2008 7:31 AM
Grasshopper
Group: General Forum Members
Last Login: Thursday, July 31, 2008 11:55 AM
Points: 11,
Visits: 22
I have a stored procedure that has several statements like print 'This is the result'
These statements are causing errors with other stored procedures that call it. I'm not permitted to modify the stored procedure that has the problem since it is part of a base product. Is there a way to turn off print so that when I call the stored procedure that has the print command, it doesn't print anything.
Thanks.
Post #449381
Grant Fritchey
Grant Fritchey
Posted Wednesday, January 30, 2008 7:39 AM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 3:41 AM
Points: 13,383,
Visits: 25,189
I've never heard of anything that'll help. You'll either have to modify the procedure to disable the PRINT statements or you have to modify the code so that it can accept the informational messages along with result sets.
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #449388
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Wednesday, January 30, 2008 7:51 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 11:20 AM
Points: 31,437,
Visits: 13,752
I'd say that you should wrap them in an IF clause, but if you can't add a parameter or logic, that might not help.
Are the print statements used? If not, I'd comment them out and alter the proc so they don't execute.
AFAIK, there's no way to prevent them if they're in code.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #449398
Robert Cearley
Robert Cearley
Posted Wednesday, January 30, 2008 8:01 AM
Grasshopper
Group: General Forum Members
Last Login: Thursday, July 31, 2008 11:55 AM
Points: 11,
Visits: 22
Yeah, the stored procedure can't be modified. It looks like the solution here may be to just copy the stored procedure without the print statements into another new proc. Thanks...
Post #449411
Lowell
Lowell
Posted Thursday, January 31, 2008 10:55 AM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 3:33 PM
Points: 11,648,
Visits: 27,768
Interesting; I'd like to know how a PRINT statement affects the other procedures;I haven;t tripped over that yet, and do a lot of programming.
Can you explain what goes wrong?
Another idea: Could it be that your confusing print statement issues with "x Rows Affected" statements, which I know can mess up ADODB recordsets (that gets fixed easily by simply adding SET NOCOUNT ON at the top of each of the procedures )
Lowell
--
There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #450093
siddharth.malhotra
siddharth.malhotra
Posted Friday, November 04, 2011 1:26 PM
Forum Newbie
Group: General Forum Members
Last Login: Saturday, March 31, 2012 12:53 PM
Points: 1,
Visits: 2
Yes, Lowell
That is the problem. I need to disable the outputs like the ones you specified.
Regards,
Sid
Post #1200863
mtassin
mtassin
Posted Friday, November 04, 2011 2:57 PM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 12:57 AM
Points: 3,231,
Visits: 64,389
siddharth.malhotra (11/4/2011)
Yes, Lowell
That is the problem. I need to disable the outputs like the ones you specified.
Regards,
Sid
Did you try putting SET NOCOUNT ON before the stored procedure is executed?
--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
Post #1200914
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.