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)
 adding users

Author  Topic 

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2002-12-02 : 03:55:05
hi ,
is it possible to add users to other databases using the sp_adduser function?
I mean if i am in the database master and I created a new database through a stored procudure and and now i have to add a new user to that database but the USE statement is not allowed in a stored procudere so it won't allow me to add a user to that database.
is there any way to do this.
I am creating a new database thru a stored proceudre and want to add a user to that database thru the same stored proc.
any help is appreciated.
thankyou.
harshal.


Andraax
Aged Yak Warrior

790 Posts

Posted - 2002-12-02 : 03:58:57
Hi!

Try this:

exec MyDatabase..sp_adduser 'MyUser'

Should work!



Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2002-12-02 : 04:53:54
quote:

Hi!

Try this:

exec MyDatabase..sp_adduser 'MyUser'

Should work!






that's great! it worked.


Go to Top of Page
   

- Advertisement -