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
 MSDE (2000)
 Add user name and password using OSQL

Author  Topic 

sbt1
Yak Posting Veteran

89 Posts

Posted - 2004-04-21 : 13:36:40
I need to add a user account (i.e. other than the sa account) to my msde database.

I tried EXEC sp_adduser 'newuser' but it tells me that 'newuser' doesn't exist. Obviously!

What is the proper syntax for this? I don't want this user to be an administrator but they do need read/write rights.

Thanks in advance.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-21 : 13:44:14
You need to use sp_addlogin to get the user into SQL Server. Then you need to use sp_grantdbaccess to grant the user access to a particular database. Then you'll need to grant rights using GRANT or you can add the user to a role with sp_addrolemember. There are two roles that you might want to look up db_datareader and db_datawriter.

Tara
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-21 : 13:45:12
Oh and if this user is a Windows account, then you'll need to use sp_grantlogin instead of sp_addlogin. All of the system stored procedures that I have mentioned are documented in SQL Server Books Online. Have a look in there for the syntax.

Tara
Go to Top of Page
   

- Advertisement -