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
 SQL Server Administration (2000)
 Create User with SQL?

Author  Topic 

robg69
Starting Member

41 Posts

Posted - 2003-07-10 : 12:26:06
Is there a way to create a user in SQL Server with SQL? Something similar to Oracle's:

CREATE USER <name> identified BY <password>

I can't seem to find any examples, so I guess you can't??

Thanks,

-Rob

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-10 : 12:31:25
This will add it to the master database:
EXEC sp_addlogin 'User1', 'password'

This will grant the above user access to the databse:
EXEC sp_grantdbaccess 'User1', 'User1'



Tara

Edited by - tduggan on 07/10/2003 12:35:28
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-10 : 12:32:27
BTW, if you can do it in Enterprise Manager, then you can do it in Query Analyzer as well.

Tara
Go to Top of Page

robg69
Starting Member

41 Posts

Posted - 2003-07-10 : 12:32:58
Thanks Tara, looks like I jumped the gun, I literally just found it...


Go to Top of Page

robg69
Starting Member

41 Posts

Posted - 2003-07-10 : 12:35:29
That's what I figured, but I'm still learning about all of the Stored Procedures.

Go to Top of Page
   

- Advertisement -