How to Create Contained Database User in SQL Server - SQL Server DBA Tutorial

In this video you will learn how to created contained database user in SQL Server using SQL Server management studio as well as using T-SQL Script. It shows various options while creating contained database user and how to assign public role to contained database user.

Scripts used in video to Create Contained Database User in SQL Server

USE [MYContainedDB]
GO

 CREATE USER [ContainedUser] WITH PASSWORD=N'Pa$$w0rd', 
 DEFAULT_SCHEMA=[dbo]
GO
 
USE [MYContainedDB]
GO

 ALTER AUTHORIZATION ON SCHEMA::[db_owner] TO [ContainedUser]
GO
 
USE [MYContainedDB]
GO
 
ALTER ROLE [db_owner] ADD MEMBER [ContainedUser]
GO



How to Create User for Contained Database in SQL Server