If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Need help in stored proc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-04-02, 07:31
thegroover thegroover is offline
Registered User
 
Join Date: Oct 2002
Posts: 4
Question Need help in stored proc

My problem is the following:

I have some aliased users and want to delete them and create them again as normal users, not as aliased. Then I have to assign them to the same db's they were assigned to, and make them members of a specified group.
Here's the code:

CREATE PROCEDURE sp_delaliases AS
set nocount on
declare @sid varbinary(85),
@loginname sysname,
@defdb sysname

create table #da
(
Name sysname Null,
sid varbinary(85) Null,
DefaultDBName sysname Null
)

insert into #da select name,sid,db_name() from sysusers where isaliased=1

select * from #da

--This is the list of all aliases and the db's they are assigned to.

Now how to go further?
May I need some code from the sp_adduser and/or from any other sp's?
Or can I simply put the names into variables, and execute the sp_adduser for them? If yes then how? (I haven't got enough experience in this)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On