jueves, 19 de abril de 2012

Create User for Contained Database


Following with conained Databases in SQL Server 2012 (Enabling contained databases), we must create a User for login in.

The first step is to create the SQL user User with Password (userName: containedUser)



Make sure to set a membership role, for example db_owner.



Now, try to connect to Contained database, choose SQL Authentication and complete your Login and Password.



The most important!, don't forgett to specify the database Name, in connection properties.



This is the flow that SQL Server use to log in Database.



Thats's all

martes, 17 de abril de 2012

Enabling contained Databases in SQL Server 2012

First of all you've to allow to your instance to use Contained Databases.

There are two ways, with GUI, or T-SQL:

In Advanced options for Server properties



Executing this statements

EXEC sys.sp_configure N'contained database authentication', N'1' GO RECONFIGURE WITH OVERRIDE GO


Then can use contained databases.

For specifying a contained DB you can go to Option menu for the Database Properties.



Or execute the T-SQL

USE [master] GO ALTER DATABASE [XYZ] SET CONTAINMENT = PARTIAL WITH NO_WAIT GO


If you want to create a new Contained Database:

CREATE DATABASE XYZ CONTAINMENT = PARTIAL