Contained database in SQL
A contained database is a database that is isolated from other databases and from the instance of SQL Server that hosts the database
--Working with contained database
sp_configure 'show advanced options',1
GO
RECONFIGURE WITH OVERRIDE
GO
sp_configure 'contained database authentication', 1
GO
RECONFIGURE WITH OVERRIDE
GO
Create Contained Database
CREATE DATABASE [ContainedDatabase]
CONTAINMENT = PARTIAL
ON PRIMARY
( NAME = N'ContainedDatabase', FILENAME = N'C:\ContainedDatabase.mdf')
LOG ON
( NAME = N'ContainedDatabase_log', FILENAME = N'C:\ContainedDatabase_log.ldf')
GO
--Create User in Contained Database
USE [ContainedDatabase]
GO
CREATE USER ContainedUser
WITH PASSWORD = 'Pa$$w0rd';
--Now login to the database using the user
Contained database in SQL
Reviewed by Rupesh
on
23:11
Rating:
No comments: