Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Decrypt and VIEW's

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2010-01-31 : 05:58:32
i want to decrypt a text, while i am using a view
select CONVERT(nvarchar, DecryptByKey(EncryptedNationalIDNumber))  from myView where id=1

like here : [url]http://msdn.microsoft.com/en-us/library/ms181860(SQL.90).aspx[/url]
when i want to decrypt, i first must open the SYMMETRIC KEY, for example :

OPEN SYMMETRIC KEY SSN_Key_01
DECRYPTION BY CERTIFICATE HumanResources037;
GO
SELECT NationalIDNumber, EncryptedNationalIDNumber
AS 'Encrypted ID Number',
CONVERT(nvarchar, DecryptByKey(EncryptedNationalIDNumber))
AS 'Decrypted ID Number'
FROM HumanResources.Employee;
GO

beacuse of unabling to do that, i thought to use a scalared-function,
but there it dosen't let me to use the "OPEN SYMMETRIC KEY"
any idea what else can i do?
Thanks
Peleg

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2010-01-31 : 06:44:03
solveed using :
http://msdn.microsoft.com/en-us/library/ms182559.aspx
Go to Top of Page
   

- Advertisement -