Stored Procedure Icon dbo.forums_GetSummaryInfo

Stored Procedure Properties

Name Value
Owner dbo
Created 2004-05-31
Startup False
Encrypted False

Creation Options

Name Value
QUOTED_IDENTIFIER OFF
ANSI_NULLS OFF

Parameters

Name DataType Length Type

Total: 0 parameter(s)

SQL

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO




create procedure forums_GetSummaryInfo AS
	-- Get summary information - Total Users, Total Posts, TotalTopics, DaysPosts, and DaysTopics
	DECLARE @TotalUsers int, @TotalPosts int, @TotalTopics int, @DaysTopics int, @DaysPosts int
	SET NOCOUNT ON
	SELECT
		@TotalUsers = (SELECT COUNT(*) FROM Users (nolock)),
		@TotalPosts = (SELECT COUNT(*) FROM Posts (nolock)),
		@TotalTopics = (SELECT COUNT(*) FROM Posts (nolock) WHERE ParentID = PostID),
		@DaysPosts = (SELECT COUNT(*) FROM Posts (nolock)
				WHERE PostDate > DATEADD(dd,-1,getdate())),
		@DaysTopics = (SELECT COUNT(*) FROM Posts (nolock)
				WHERE ParentID = PostID AND PostDate > DATEADD(dd,-1,getdate()))
	SET NOCOUNT OFF
	SELECT TotalUsers = @TotalUsers,
		TotalPosts = @TotalPosts,
		TotalTopics = @TotalTopics,
		DaysPosts = @DaysPosts,
		DaysTopics = @DaysTopics












GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


					

Generated on 26/08/2004 15:05:30 by DataAide.