Stored Procedure Icon dbo.forums_GetTotalUsers

Stored Procedure Properties

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

Creation Options

Name Value
QUOTED_IDENTIFIER ON
ANSI_NULLS ON

Parameters

Name DataType Length Type
@UserNameBeginsWith nvarchar 2 INPUT
@UserNameToFind nvarchar 100 INPUT

Total: 2 parameter(s)

SQL

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO




CREATE     PROCEDURE forums_GetTotalUsers
(
	@UserNameBeginsWith nvarchar(1),
	@UserNameToFind nvarchar(50)
)
AS

IF @UserNameBeginsWith IS NULL AND @UserNameToFind IS NULL
	SELECT
		COUNT (*)
	FROM
		Users
	WHERE
		DisplayInMemberList = 1 AND
		Approved = 1
ELSE
	IF @UserNameToFind IS NULL
		SELECT
			COUNT (*)
		FROM
			Users
		WHERE
			DisplayInMemberList = 1 AND
			Approved = 1 AND 
			LEFT(UserName, 1) = @UserNameBeginsWith
	ELSE
		SELECT
			COUNT (*)
		FROM
			Users
		WHERE
			DisplayInMemberList = 1 AND
			Approved = 1 AND 
			Username like '%' + @UserNameToFind + '%'








GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


					

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