| 
 | 
								
									
										|  |  
										|  |  
										| |  Click here to copy the following block |  | IF EXISTS (select * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[fnSPisRunning]') AND xtype in (N'FN', N'IF', N'TF')) DROP function [dbo].[fnSPisRunning]
 GO
 CREATE function fnSPisRunning (@objid int)
 returns bit
 
 
 
 begin
 DECLARE @return bit
 DECLARE @syscacheobjects TABLE (
 cacheobjtype nvarchar(17) NOT null,
 refcounts int NOT NULL
 )
 INSERT INTO @syscacheobjects
 SELECT cacheobjtype, refcounts
 FROM master.dbo.syscacheobjects WITH (nolock)
 WHERE objid = @objid
 AND    dbid = db_id()
 IF isnull((select refcounts
 FROM @syscacheobjects
 WHERE cacheobjtype = 'Compiled Plan'),0)
 =
 (select count(*)
 FROM @syscacheobjects)
 SET @return = 0
 ELSE
 SET @return = 1
 RETURN @return
 end
 GO
 | 
 |  
										|  |  
										|  |  
 
	
		| 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 ) |  |  |