SQL Server - Login

About

A login can:

The database user is the identity of the login when it is connected to a database. The database user can use the same name as the login, but that is not required.

Management

Create

SQL

Create Statement: Create a login

  • Azure SQL
CREATE LOGIN loginName WITH
		PASSWORD = 'pwd';
  • SQL Server
CREATE LOGIN loginName WITH
		PASSWORD = 'pwd',
		DEFAULT_DATABASE = DefaultDatabase;

Built-in Procedure

  • With the the sp-addlogin function. Example: creates a SQL Server login for the user userName, with a password of pwd and a default database of defaultDatabaseName
EXEC sp_addlogin 'userName', 'pwd', 'defaultDatabaseName'; 
GO  

Drop

Password

ALTER LOGIN login_name WITH PASSWORD = 'pwd'

List

  • SQL Azure
SELECT * from master.sys.sql_logins;

Powered by ComboStrap