Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Deleting users with 'aspnet_Users_DeleteUser'

Author  Topic 

vermorel
Starting Member

26 Posts

Posted - 2006-06-03 : 15:28:44
ASP.NET provides the stored procedure 'aspnet_Users_DeleteUser' to delete a user. I have a simple SQL query that returns a table containing only a list of 'UserId'. I would like to destroy all those users (in all tables) with 'aspnet_Users_DeleteUser'.

Does anyone has an idea how to do such a "FOR EACH" process within a SQL query?

Thanks in advance,
Joannès
[url]http://www.peoplewords.com[/url]

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-03 : 15:58:02
declare @userid varchar(128)
select @userid = ''
while @userid < (select max(userid) from tbl)
begin
select @userid = min(userid) from tbl where userid > @userid
exec aspnet_Users_DeleteUser @userid
end


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -