[RESOLVED] Error creating a function
Hello everybody,
I am trying to create the following function but it gives error "Invalid use of side-effecting or time-dependent operator in 'OPEN SYMMETRIC KEY' within a function."
Code:
CREATE FUNCTION GetEncryptedPassword
(
@Password VARCHAR(10)
)
RETURNS VARBINARY
AS
BEGIN
OPEN SYMMETRIC KEY PasswordFieldKey
DECRYPTION BY CERTIFICATE PasswordFieldCertificate;
RETURN EncryptByKey(Key_GUID('PasswordFieldKey'),@Password)
END
GO
Can we figure out why it's giving this error?
Thanks.
Re: Error creating a function
the answer lays here - in post #2.
-tg