Create a Database Master Key
This topic describes how to create a database master key in SQL Server 2012 by using Transact-SQL.
In This Topic
Before you begin:
Security
To create a database master key using Transact-SQL
Before You Begin
Security
Permissions
Requires CONTROL permission on the database.
[Top]
Using Transact-SQL
To create a database master key
Choose a password for encrypting the copy of the master key that will be stored in the database.
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
-- Creates a database master key for the "AdventureWorks2012" database. -- The key is encrypted using the password "23987hxJ#KL95234nl0zBe." USE AdventureWorks2012; GO CREATE MASTER KEY ENCRYPTION BY PASSWORD = '23987hxJ#KL95234nl0zBe'; GO
For more information, see CREATE MASTER KEY (Transact-SQL).
[Top]