USE [VEPROMS]
GO
/****** Object:  StoredProcedure [dbo].getRoFstSize    Script Date: 01/20/2011 12:35:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/*
getRoFstBySize 1,74928
 */	
alter PROCEDURE [dbo].[getRoFstBySize]
(
	@RODbID int,
	@Len int
)
WITH EXECUTE AS OWNER
AS
select 
	[ROFstID],
		[RODbID],
		[ROLookup],
		[Config],
		[DTS],
		[UserID],
		[LastChanged],
		(SELECT COUNT(*) FROM [Associations] WHERE [Associations].[ROFstID]=[ROFsts].[ROFstID]) [AssociationCount],
		(SELECT COUNT(*) FROM [Figures] WHERE [Figures].[ROFstID]=[ROFsts].[ROFstID]) [FigureCount] 
from [ROFsts]
where len(rolookup) = @len and [RODbID] = @RODbID
RETURN