Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartynJones87/3104868 to your computer and use it in GitHub Desktop.
Save MartynJones87/3104868 to your computer and use it in GitHub Desktop.
SQL Server Script To Migrate Membership Data From SQL Provider Schema To Universal Provider Schema
--The sample scripts provided here are not supported under any We Predict Ltd standard support program or service. All scripts are provided AS IS without warranty of any kind. We Predict Ltd further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall We Predict Ltd, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if We Predict Ltd has been advised of the possibility of such damages.
INSERT INTO dbo.Applications (ApplicationName, ApplicationId, Description)
SELECT ApplicationName, ApplicationId, Description
FROM aspnet_Applications
GO
INSERT INTO dbo.Users (ApplicationId, UserId, UserName, IsAnonymous,
LastActivityDate)
SELECT ApplicationId, UserId, UserName, IsAnonymous, LastActivityDate
FROM dbo.aspnet_Users AS au
GO
INSERT INTO dbo.Memberships (ApplicationId, UserId, Password, PasswordFormat,
PasswordSalt, Email, PasswordQuestion,
PasswordAnswer, IsApproved, IsLockedOut,
CreateDate, LastLoginDate,
LastPasswordChangedDate, LastLockoutDate,
FailedPasswordAttemptCount,
FailedPasswordAttemptWindowStart,
FailedPasswordAnswerAttemptCount,
FailedPasswordAnswerAttemptWindowsStart, Comment)
SELECT ApplicationId, UserId, Password, PasswordFormat, PasswordSalt,
Email, PasswordQuestion, PasswordAnswer,
IsApproved, IsLockedOut, CreateDate, LastLoginDate,
LastPasswordChangedDate, LastLockoutDate, FailedPasswordAttemptCount,
FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount,
FailedPasswordAnswerAttemptWindowStart, Comment
FROM dbo.aspnet_Membership AS am
GO
INSERT INTO dbo.Roles (ApplicationId, RoleId, RoleName, Description)
SELECT ApplicationId, RoleId, RoleName, Description
FROM dbo.aspnet_Roles AS ar
GO
INSERT INTO dbo.UsersInRoles (UserId, RoleId)
SELECT UserId, RoleId
FROM dbo.aspnet_UsersInRoles AS auir
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment