0

I have two databases . I copied all the data from one table and inserted into another database table . I have created symmetric key on second database but when i try to run the query as follow

 OPEN SYMMETRIC KEY SecureSymmetricKey DECRYPTION BY PASSWORD = N'StrongPassword';        
 select DecryptByKey(columname) as DocSSN from tablename
 CLOSE SYMMETRIC KEY SecureSymmetricKey; 

but allway return null value.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
pardeep dhingra
  • 137
  • 1
  • 2
  • 7

1 Answers1

0

You need to follow the steps described in Create Identical Symmetric Keys on Two Servers. You will have to re-encrypt all the data on both servers/databases with a newly created symmetric key that uses the given known key material. Creating a key copy after the fact is not possible.

Sharing symmetric keys between servers/databases is a very bad practice. You should encrypt with different keys on each database.

Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569