–Creating a Windows Login for SQL Server
–Create a SQL Login of Windows user account to access the SQL Server ONLY
USE [master]
GO
CREATE LOGIN [DBAJohney]
FROM WINDOWS
WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english]
GO
—–Create a SQL User using SQL Login to access the database
USE [AdventureWorks2012]
GO
CREATE USER [Johney]
FOR LOGIN [DBAJohney] — SQL Login
WITH DEFAULT_SCHEMA=[dbo]
GO
— Grant permission to SQL User to access a table
use [AdventureWorks2012]
GO
GRANT SELECT
ON [HumanResources].[Department]
TO [Johney] AS [dbo]
GO