Wednesday, January 4, 2012

How to delete a user from ASP.NET membership database by SQL?

   DECLARE @UserId uniqueidentifier

   SET @UserId = 'userid in here F6817A3F-D0AF-4715-8A5C-4750E2C9EA2D'
   
   DELETE FROM aspnet_Profile WHERE UserID = @UserId

   DELETE FROM aspnet_UsersInRoles WHERE UserID = @UserId

   DELETE FROM aspnet_PersonalizationPerUser WHERE UserID = @UserId

   DELETE FROM dbo.aspnet_Membership WHERE UserID = @UserId

   DELETE FROM aspnet_users WHERE UserID = @UserId


No comments:

Post a Comment