ASPNETDB Database

Procedure: aspnet_Profile_GetNumberOfInactiveProfiles

Description

Queries the aspnet_Profile table to get a count of profiles whose last activity dates (in the aspnet_Users table) fall on or before the specified date.

Parameters

Name  Type  Direction 
@ApplicationName  nvarchar  Input 
@ProfileAuthOptions  int  Input 
@InactiveSinceDate  datetime  Input 

Definition

CREATE PROCEDURE dbo.aspnet_Profile_GetNumberOfInactiveProfiles
@ApplicationName nvarchar(256),
@ProfileAuthOptions int,
@InactiveSinceDate datetime
AS
BEGIN
DECLARE @ApplicationId uniqueidentifier
SELECT @ApplicationId = NULL
SELECT @ApplicationId = ApplicationId FROM aspnet_Applications WHERE LOWER(@ApplicationName) = LoweredApplicationName
IF (@ApplicationId IS NULL)
BEGIN
SELECT 0
RETURN
END

SELECT COUNT(*)
FROM dbo.aspnet_Users u, dbo.aspnet_Profile p
WHERE ApplicationId = @ApplicationId
AND u.UserId = p.UserId
AND (LastActivityDate <= @InactiveSinceDate)
AND (
(@ProfileAuthOptions = 2)
OR (@ProfileAuthOptions = 0 AND IsAnonymous = 1)
OR (@ProfileAuthOptions = 1 AND IsAnonymous = 0)
)
END


ASP.NET 2.0 Provider Database