• Login

Snippets

27

 

@rUser table (UserId int) 'Set UserID' into @rUser (UserId) values (9)

Print

'=================================='

Print

'DELETE from aspnet_Membership'

DELETE

from aspnet_Membership where UserId in (SELECT au.UserId from aspnet_Users au join users u on au.username = u.username where u.userid in (select * from @rUser) )

Print

'=================================='

Print

'DELETE from aspnet_Users'

DELETE

from aspnet_Users where UserId in (SELECT au.UserId from aspnet_Users au join users u on au.username = u.username where u.userid in (select * from @rUser) )

-- clear profile properties

Print

'=================================='

Print

'DELETE from UserProfile'

DELETE

 

FROM UserProfile where UserID in (SELECT UserId from users where userid in (select * from @rUser) )

-- clear portal relationships with users

Print

'=================================='

Print

'DELETE from UserPortals'

DELETE

 

FROM UserPortals where UserID in (SELECT UserId from users where userid in (select * from @rUser) )

-- clear role relationships with users

Print

'=================================='

Print

'DELETE from UserRoles'

DELETE

 

FROM UserRoles where UserID in (SELECT UserId from users where userid in (select * from @rUser) )

 

-- finally remove core user profile info

Print

'=================================='

Print

'DELETE from Users'

DELETE

FROM users where userid in (select * from @rUser)

 

 

Print

 

-- WAIT WAIT WAIT WAIT - remember to put in the right userid

insert

 

declare

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Name (required)

Email (required)

Website