How to use the PRINT statement to track execution as stored procedure is running?

Posted by Saranya Boopathi under Sql Server on 5/28/2013 | Points: 10 | Views : 7705 | Status : [Member] | Replies : 2
I have a stored procedure with a while loop in it and I want some messages to be printed after every loops...Procedure Executed Successfully....But I want to Print Message after every Loop...

Create Procedure [dbo].[XXXX_SP]
(
@XXX DateTime,
@YYY varchar(10) )
As
Begin
Set @TotCnt=ceiling(@TotCnt)
While @Cnt= @TotCnt
Begin
Print 'File Processing Started '+Str(@Cnt)
Execute XXXXXX ()
Set @SqlQry =Select b.Zone,b.Division,a.* into from test a left join final b on a.[aaa]=b.aaa
Exec (@SqlQry)
Set @Cnt=@Cnt+1
End
End


Saranya Boopathi


Responses

Posted by: Pandians on: 5/28/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
DECLARE @A INT

SELECT @A = 1
WHILE(@A <=10)
BEGIN
PRINT 'Result ' + CAST(@A AS VARCHAR)
SELECT @A = @A +1
END
GO


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Saranya Boopathi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Saranya Boopathi on: 5/29/2013 [Member] Starter | Points: 25

Up
0
Down
I got Solution...

RAISERROR ('File Processing Started ', 0, 1) WITH NOWAIT


Saranya Boopathi

Saranya Boopathi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response