| 
							 
 
						 | 
						
							
								
									
										 | 
									 
									
										 | 
									 
									
										
											| Some sample code that shows how to return progress info from long running SPs. This is useful for reporting purposes or to include other mechanisms to control the SP execution. |  
   Click here to copy the following block |  
  CREATE TABLE ##Progress( Step int , ItTookSoLong int ) GO
  CREATE PROC EverRunningProc AS DECLARE @step int , @Delay char(10) SELECT @step = 1 WHILE( 1 = 1) BEGIN   IF @step = 1000 BREAK   INSERT ##Progress VALUES( @Step , 0 )      SELECT @Delay = CONVERT( varchar, DATEADD( ss, CEILING( RAND()* 44 ),               '1970-01-01') , 8 )   WAITFOR DELAY @Delay
    UPDATE ##Progress   SET ItTookSoLong = datepart( ss, convert( datetime , @Delay ) ) ,     @Step = Step + 1   WHERE Step = @Step END GO
 
 
  SELECT MAX( Step ) % 1000.0 AS StepPer FROM ##Progress |   
             
										 | 
									 
									
										| 
											
										 | 
									 
									
										| 
 | 
									 
								
							 
							
							
 
	
		| 
			Submitted By :
					Nayan Patel 
					 (Member Since : 5/26/2004 12:23:06 PM)
		 | 
	 
	
		  | 
	 
	
		| 
			 
				  
		 | 
		
			Job Description :   
			He is the moderator of this site and  currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. | 
	 
	
		| 
			View all (893) submissions by this author 
			(Birth Date : 7/14/1981 ) | 
	 
 
						 | 
						
						 |