Results 1 to 2 of 2

Thread: [RESOLVED] Error creating a function

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Resolved [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.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Error creating a function

    the answer lays here - in post #2.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width