Posted By: Anonymous
I am trying to debug stored procedures in SQL Server Management Studio 2008. I want to insert some print statements to test some IF-statements that I know are wrong.
In order to do debugging, I tried using the
PRINT '5' command.
I tried using the
'RAISERROR (N'Start',10,1) WITH NOWAIT'.
But these did not show any printouts, only the result set. The message just says
1 row affected.
I attempted to write the code like so (perhaps this is an incorrect approach):
SET NOCOUNT ON RAISERROR (N'Start',10,1) WITH NOWAIT DECLARE @DocHandle INT DECLARE @PageSize INT, @PageIndex INT, @TOTL_CONT NUMERIC(5,0), @Paging BIT DECLARE @Type INT, @Search varchar(20) , @ORDE nVARCHAR(50), @SORT_ID nVARCHAR(50) DECLARE @CreatedOn varchar(25), @SystemGenerate bit
What is the best way to use print statements to debug a stored procedure?
If you’re using MSSQL Server management studio print statements will print out under the messages tab not under the Results tab.
Print statements will appear there.