Stored Procedure Icon dbo.forums_GetUsersOnline

Stored Procedure Properties

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

Creation Options

Name Value
QUOTED_IDENTIFIER OFF
ANSI_NULLS ON

Parameters

Name DataType Length Type
@PastMinutes int 4 INPUT

Total: 1 parameter(s)

SQL

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO




CREATE      PROCEDURE forums_GetUsersOnline
(
	@PastMinutes int
)
 AS
BEGIN

	-- Get online users
	SELECT
		Username,
		Administrator = (SELECT TOP 1 Count(*) FROM UsersInRoles WHERE Rolename = 'Forum-Administrators' AND Username = U.Username),
		IsModerator = (SELECT Count(*) FROM Moderators where username = U.Username)
	FROM
		Users U
	WHERE
		LastActivity > DateAdd(minute, -@PastMinutes, GetDate())
END















GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


					

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