ASPNETDB Database

Procedure: aspnet_Profile_DeleteInactiveProfiles

Description

Deletes profile data from the aspnet_Profile table for users 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_DeleteInactiveProfiles
@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

DELETE
FROM dbo.aspnet_Profile
WHERE UserId IN
( SELECT UserId
FROM dbo.aspnet_Users u
WHERE ApplicationId = @ApplicationId
AND (LastActivityDate <= @InactiveSinceDate)
AND (
(@ProfileAuthOptions = 2)
OR (@ProfileAuthOptions = 0 AND IsAnonymous = 1)
OR (@ProfileAuthOptions = 1 AND IsAnonymous = 0)
)
)

SELECT @@ROWCOUNT
END


ASP.NET 2.0 Provider Database