-2
USE MyDatabase
GO
CREATE DATABASE ENCRYPTION KEY
WITH ENCRYPTION
ALGORITHM = AES_256 BY SERVER CERTIFICATE TDECert

GO

when i execute this statement in SQL Server 2008 I get the error:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'KEY'.
Msg 319, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

What to do? I just want to encrypt my db.

Marcel Korpel
  • 21,536
  • 6
  • 60
  • 80
mahima
  • 1
  • 1

2 Answers2

1

what you miss is Encryption by so the corrected script will be below:

USE MyDatabase 
GO 
CREATE DATABASE ENCRYPTION KEY 
WITH ENCRYPTION ALGORITHM = AES_256 
 ENCRYPTION BY SERVER CERTIFICATE TDECert  
GO 
Jamiec
  • 133,658
  • 13
  • 134
  • 193
OPABID
  • 11
  • 1
1

The only difference I see between your example and the MSDN example is the capitalization of the word WITH

Joe Phillips
  • 49,743
  • 32
  • 103
  • 159