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 2005 Forums
 SQL Server Administration (2005)
 adding new user

Author  Topic 

mhdmehraj
Starting Member

6 Posts

Posted - 2010-11-09 : 04:24:01
Hi i have a datatabase which consits of procedure functions and tables.
Now i need to create a new user in that databaase which i need to grant all the privilages upon those procedures, functions and tables.

including the trucate and everything.

iam an oracle dba .. but iam new to this.
How to create a user and grant the privilages

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-11-09 : 14:51:47
The syntax for creating anew user is : USE MY_DB_NAME CREATE USER aUserName FOR LOGIN aLogin;

A number of variations exist of how to create a user - which can be looked up on BOL. The above example , assumes a Login account exists , the basic principle being that a database user account must be linke to a login account.

Once you've created the relevant database user , the permissions are associates to the account.
For example, exec sp_addrolemember 'db_datareader', 'aUserName' .

This example will give them read rights to a database.

If you need to add further permissions , look up the roles details , and add the role to the user


Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -