Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating an user ???

Status
Not open for further replies.

kindus

IS-IT--Management
Jul 25, 2001
77
US
How do I create an user in SQL server? I could not find any command to create an user, nearest is creating a schema.

Please Ctrl F1!!
 
I would like to execute it from osql prompt just like I do in oracle.

thanks
 
I'm fairly new. Coming across from an Access background. Have you tried
sp_grantdbaccess [@loginame =] 'login'
[,[@name_in_db =] 'name_in_db' [OUTPUT]]

 

You need to create a SQL Server login first.

Add login for SQL authentication
sp_addlogin [@loginame =] 'login'
[,[@passwd =] 'password']
[,[@defdb =] 'database']
[,[@deflanguage =] 'language']
[,[@sid =] 'sid']
[,[@encryptopt =] 'encryption_option']

Add login for NT authentication
sp_grantlogin [@loginame =] 'login'

Create a user in each database you want the login to access.

sp_grantdbaccess [@loginame =] 'login'
[,[@name_in_db =] 'name_in_db' [OUTPUT]]

name_in_db is commonly called the user.

You can accomplish the same in Enterprise manager (EM). Look under Server Security. Right click logins. Select New Login. Type in a name. Select databses you want the login to access. Select a default database. Set server roles if appropriate.

I prefer to use EM to administer security. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it if you have time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top