ALTER PROCEDURE dbo.aspnet_Membership_GetUserByEmail --通过邮箱获取用户名
@ApplicationName NVARCHAR(256),
@Email NVARCHAR(256)
AS
BEGIN
IF( @Email IS NULL )
SELECT u.UserName
FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
u.ApplicationId = a.ApplicationId AND
u.UserId = m.UserId AND
m.LoweredEmail IS NULL
/**//*如果邮件地址为空,查找地址为空的用户的用户名(都是三表连接)*/
ELSE
SELECT u.UserName
FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
u.ApplicationId = a.ApplicationId AND
u.UserId = m.UserId AND
LOWER(@Email) = m.LoweredEmail
/**//*如果不为空,查询相同电子邮件地址的用户的用户名*/
IF (@@rowcount = 0) --如果受影响行数为0
RETURN(1)
RETURN(0)
END
@ApplicationName NVARCHAR(256),
@Email NVARCHAR(256)
AS
BEGIN
IF( @Email IS NULL )
SELECT u.UserName
FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
u.ApplicationId = a.ApplicationId AND
u.UserId = m.UserId AND
m.LoweredEmail IS NULL
/**//*如果邮件地址为空,查找地址为空的用户的用户名(都是三表连接)*/
ELSE
SELECT u.UserName
FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
u.ApplicationId = a.ApplicationId AND
u.UserId = m.UserId AND
LOWER(@Email) = m.LoweredEmail
/**//*如果不为空,查询相同电子邮件地址的用户的用户名*/
IF (@@rowcount = 0) --如果受影响行数为0
RETURN(1)
RETURN(0)
END
1ALTER PROCEDURE dbo.aspnet_Membership_GetUserByName --通过用户名获取用户
2 @ApplicationName NVARCHAR(256),
3 @UserName NVARCHAR(256),
4 @TimeZoneAdjustment INT,
5 @UpdateLastActivity BIT = 0
6AS
7BEGIN
8 IF (@UpdateLastActivity = 1)--更新最近活动
9 BEGIN
10 DECLARE @DateTimeNowUTC DATETIME
11 EXEC dbo.aspnet_GetUtcDate @TimeZoneAdjustment, @DateTimeNowUTC OUTPUT
12 UPDATE dbo.aspnet_Users
13 SET LastActivityDate = @DateTimeNowUTC
14 FROM dbo.aspnet_Applications a, dbo.aspnet_Users u
15 WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
16 u.ApplicationId = a.ApplicationId AND
17 u.LoweredUserName = LOWER(@UserName)
18
19 IF (@@ROWCOUNT = 0) -- Username not found
20 RETURN -1
21 END
22 /**//*如果更新活动时间为真,设置最近活动时间为当前时间*/
23
24 SELECT m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
25 m.CreateDate, m.LastLoginDate, u.LastActivityDate, m.LastPasswordChangedDate,
26 u.UserId, m.IsLockedOut,m.LastLockoutDate
27 FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
28 WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
29 u.ApplicationId = a.ApplicationId AND
30 u.LoweredUserName = LOWER(@UserName) AND
31 u.UserId = m.UserId
32 /**//*三表连接查询(aspnet_Users/aspnet_Applications/aspnet_Membership好象有连就
33 要连一起)*/
34 IF (@@ROWCOUNT = 0) -- Username not found
35 RETURN -1
36
37 RETURN 0
38END
2 @ApplicationName NVARCHAR(256),
3 @UserName NVARCHAR(256),
4 @TimeZoneAdjustment INT,
5 @UpdateLastActivity BIT = 0
6AS
7BEGIN
8 IF (@UpdateLastActivity = 1)--更新最近活动
9 BEGIN
10 DECLARE @DateTimeNowUTC DATETIME
11 EXEC dbo.aspnet_GetUtcDate @TimeZoneAdjustment, @DateTimeNowUTC OUTPUT
12 UPDATE dbo.aspnet_Users
13 SET LastActivityDate = @DateTimeNowUTC
14 FROM dbo.aspnet_Applications a, dbo.aspnet_Users u
15 WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
16 u.ApplicationId = a.ApplicationId AND
17 u.LoweredUserName = LOWER(@UserName)
18
19 IF (@@ROWCOUNT = 0) -- Username not found
20 RETURN -1
21 END
22 /**//*如果更新活动时间为真,设置最近活动时间为当前时间*/
23
24 SELECT m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
25 m.CreateDate, m.LastLoginDate, u.LastActivityDate, m.LastPasswordChangedDate,
26 u.UserId, m.IsLockedOut,m.LastLockoutDate
27 FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
28 WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
29 u.ApplicationId = a.ApplicationId AND
30 u.LoweredUserName = LOWER(@UserName) AND
31 u.UserId = m.UserId
32 /**//*三表连接查询(aspnet_Users/aspnet_Applications/aspnet_Membership好象有连就
33 要连一起)*/
34 IF (@@ROWCOUNT = 0) -- Username not found
35 RETURN -1
36
37 RETURN 0
38END