Login  Register 
Home
 
Applications
 
Consulting
 
Design
 
Business Links
 
Support
 
Contact
  Search
Search
 
 SupportKnowledge BaseMicrosoft SQL ServerStored Procedures     May 17, 2012  
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

Only registered users may post comments.
 

P.O. BOX 2342 ~ BREWSTER, MA 02631
PHONE & FAX: (508) 714-0678

 
 Copyright 2012 by Global Internet Business Solutions   Terms Of Use  Privacy Statement