text: ﻿CREATE PROCEDURE [dbo].[aspnet_Membership_GetPasswordWithFormat]
      @ApplicationName                nvarchar(256),
      @UserName                       nvarchar(256),
      @UpdateLastLoginActivityDate    bit,
      @CurrentTimeUtc                 datetime
  AS
  BEGIN
      DECLARE @IsLockedOut                        bit
      DECLARE @UserId                             uniqueidentifier
      DECLARE @Password                           nvarchar(128)
      DECLARE @PasswordSalt                       nvarchar(128)
      DECLARE @PasswordFormat                     int
      DECLARE @FailedPasswordAttemptCount         int
      DECLARE @FailedPasswordAnswerAttemptCount   int
      DECLARE @IsApproved                         bit
      DECLARE @LastActivityDate                   datetime
      DECLARE @LastLoginDate                      datetime
  
      SELECT  @UserId          = NULL
  
      SELECT  @UserId = u.UserId, @IsLockedOut = m.IsLockedOut, @Password=Password, @PasswordFormat=PasswordFormat,
              @PasswordSalt=PasswordSalt, @FailedPasswordAttemptCount=FailedPasswordAttemptCount,
  		    @FailedPasswordAnswerAttemptCount=FailedPasswordAnswerAttemptCount, @IsApproved=IsApproved,
              @LastActivityDate = LastActivityDate, @LastLoginDate = LastLoginDate
      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(@UserName) = u.LoweredUserName
  
      IF (@UserId IS NULL)
          RETURN 1
  
      IF (@IsLockedOut = 1)
          RETURN 99
  
      SELECT   @Password, @PasswordFormat, @PasswordSalt, @FailedPasswordAttemptCount,
               @FailedPasswordAnswerAttemptCount, @IsApproved, @LastLoginDate, @LastActivityDate
  
      IF (@UpdateLastLoginActivityDate = 1 AND @IsApproved = 1)
      BEGIN
          UPDATE  dbo.aspnet_Membership
          SET     LastLoginDate = @CurrentTimeUtc
          WHERE   UserId = @UserId
  
          UPDATE  dbo.aspnet_Users
          SET     LastActivityDate = @CurrentTimeUtc
          WHERE   @UserId = UserId
      END
  
  
      RETURN 0
  END