Solved

How to create a User Account in Microsoft SQL Databse

Posted on 2012-12-21
5
236 Views
Last Modified: 2013-01-01
Hi,
Can anyone explain how to creat A User Account in a SQL Database.
0
Comment
Question by:Computers4me
5 Comments
 
LVL 22

Expert Comment

by:Steve Wales
ID: 38714496
It's a two step process.

First you have to create a login to the instance.

That can be a SQL Server account (with a password) or you take take the Windows AD login and pass that through.

Then you create a user in the database connected to that login and grant appropriate privileges.

use master
go
create login [fred] from windows with default database=[master]
go
use demo
go
create user fred for login fred
go
grant select on table to fred

Open in new window


The user name and the login name do not have to be the same.  Make sure you grant object permissions to the user, not the login.

There are exceptions, for example you can make a login a system wide administrator for all databases on the instance.

From the documentation:

Creating a login: http://msdn.microsoft.com/en-us/library/aa337562.aspx
Creating a user: http://msdn.microsoft.com/en-us/library/ms173463.aspx
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38714509
you can also right click on the database, and use the graphic user interface
0
 

Author Comment

by:Computers4me
ID: 38714512
How would you Pass through an AD User account?
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 38714535
If my domain is MYDOMAIN and my account is sjwales it would be:

create login [MYDOMAIN\sjwales] from windows with default database=[master]

Open in new window


All of this can be done from the SSMS GUI as well as indicated by esskayb2d.

The username could then be anything, drop the domain from user if you want, for example.

create user sjwales for login [MYDOMAIN\sjwales]

Open in new window


and then assign appropriate permissions to sjwales as needed.
0
 
LVL 21

Accepted Solution

by:
Alpesh Patel earned 500 total points
ID: 38715021
In security tab create login as like

Create login
In database security node create user as like

create user
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now