Solved

How to create a User Account in Microsoft SQL Databse

Posted on 2012-12-21
5
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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