ALTER PROCEDURE [dbo].[ProcMyProc](@.ClearText nvarchar(50))
AS
BEGIN
OPEN SYMMETRIC KEY MyKey DECRYPTION BY PASSWORD= 'MY_Password_128';
Declare @.Temp varbinary(8000);
Set @.Temp =EncryptByKey(Key_GUID('MyKey'),@.ClearText);
close symmetric key MyKey;
select @.Temp as temp;
END
The result I get for this procedure is null. Is there something wrong with this code?
Hey Muhammad,
I tried out your code and it seems to work for me. Can you try executing your script outside of the proc? You can add in "select * from sys.openkeys" after your open statement just to check to see if the key was actually opened.
Sung
|||Also, if this still doesn't work, can you let us know what OS version you are using? Is it XP, 2000, or 2003?
Thanks
Laurentiu
Hi Muhammad,
The way our built-ins work is that they return null instead of returning an error. I don't remember why exactly this is the case, but I think it has to do with backwards compatibility and parsing logic of the built-ins.
Sung
No comments:
Post a Comment