Aleksei Chepovoi
Aleksei Chepovoi

Reputation: 3955

How to make windows user has access to sql server with integrated security?

I have a windows user, e.g. "User1". And I what this User1 to have access to my database.

This code is to create new login and new user in my database:

CREATE LOGIN user1
WITH PASSWORD = 'password1';
GO
CREATE USER user1 FOR LOGIN user1;
GO

Edited Questions:

1) How to map these two users: "User1" and "user1"?

2) Will this windows user "User1" have access to sql server with integrated security?

Upvotes: 0

Views: 1561

Answers (2)

Alex
Alex

Reputation: 23300

Use SQL Server Management Studio to create the login. Here is how to do it (MSDN link).

TSQL code to accomplish this is also provided in the same page (too long to copy paste here, partial copypaste would be meaningless).

Upvotes: 0

muhmud
muhmud

Reputation: 4604

use master
GO

create login [<YourDomain>\User1] from windows;
GO

use [<YourDatabase>]
GO

create user [<YourDomain>\User1] from login [<YourDomain>\User1]
GO

Upvotes: 3

Related Questions