1ALTER PROCEDURE dbo.aspnet_Profile_DeleteInactiveProfiles
2 @ApplicationName NVARCHAR(256),
3 @ProfileAuthOptions INT,
4 @InactiveSinceDate DATETIME,
5 @TimeZoneAdjustment INT
6AS
7BEGIN
8 DECLARE @ApplicationId UNIQUEIDENTIFIER
9 SELECT @ApplicationId = NULL
10 SELECT @ApplicationId = ApplicationId FROM aspnet_Applications WHERE LOWER(@ApplicationName) = LoweredApplicationName
11 ---查询应用程序ID
12 IF (@ApplicationId IS NULL)
13 BEGIN
14 SELECT 0
15 RETURN
16 END
17
18 IF (@InactiveSinceDate > CONVERT(DATETIME, '17540101', 112) AND @InactiveSinceDate < CONVERT(DATETIME, '99980101', 112))
19 --如果停滞以来的时间在系统时间内(目前是不会超过条件的时间的)
20 SELECT @InactiveSinceDate = DATEADD(n, -@TimeZoneAdjustment, @InactiveSinceDate)
21
22 DELETE
23 FROM dbo.aspnet_Profile
24 WHERE UserId IN
25 ( SELECT UserId
26 FROM dbo.aspnet_Users u
27 WHERE ApplicationId = @ApplicationId
28 AND (LastActivityDate <= @InactiveSinceDate)
29 AND (
30 (@ProfileAuthOptions = 2)
31 OR (@ProfileAuthOptions = 0 AND IsAnonymous = 1)
32 OR (@ProfileAuthOptions = 1 AND IsAnonymous = 0)
33 )
34 )
35 ---删除USERID在这一范围内的记录
36 SELECT @@ROWCOUNT
37END
2 @ApplicationName NVARCHAR(256),
3 @ProfileAuthOptions INT,
4 @InactiveSinceDate DATETIME,
5 @TimeZoneAdjustment INT
6AS
7BEGIN
8 DECLARE @ApplicationId UNIQUEIDENTIFIER
9 SELECT @ApplicationId = NULL
10 SELECT @ApplicationId = ApplicationId FROM aspnet_Applications WHERE LOWER(@ApplicationName) = LoweredApplicationName
11 ---查询应用程序ID
12 IF (@ApplicationId IS NULL)
13 BEGIN
14 SELECT 0
15 RETURN
16 END
17
18 IF (@InactiveSinceDate > CONVERT(DATETIME, '17540101', 112) AND @InactiveSinceDate < CONVERT(DATETIME, '99980101', 112))
19 --如果停滞以来的时间在系统时间内(目前是不会超过条件的时间的)
20 SELECT @InactiveSinceDate = DATEADD(n, -@TimeZoneAdjustment, @InactiveSinceDate)
21
22 DELETE
23 FROM dbo.aspnet_Profile
24 WHERE UserId IN
25 ( SELECT UserId
26 FROM dbo.aspnet_Users u
27 WHERE ApplicationId = @ApplicationId
28 AND (LastActivityDate <= @InactiveSinceDate)
29 AND (
30 (@ProfileAuthOptions = 2)
31 OR (@ProfileAuthOptions = 0 AND IsAnonymous = 1)
32 OR (@ProfileAuthOptions = 1 AND IsAnonymous = 0)
33 )
34 )
35 ---删除USERID在这一范围内的记录
36 SELECT @@ROWCOUNT
37END
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· 新年开篇:在本地部署DeepSeek大模型实现联网增强的AI应用
· Janus Pro:DeepSeek 开源革新,多模态 AI 的未来
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(三):用.NET IoT库
· 【非技术】说说2024年我都干了些啥