DecryptByPassphrase where key has single apostrophe

  • Hi All,
    i wonder if anyone has an example of a decryptbypassphrase where the key (in this case a varchar parameter) has an apostrophe?
    see below for my example:
    SELECT cast(DecryptByPassphrase(''' + @uncryptpassword + ''',dbo.tblx.eePassword) as varchar(32)) as eePassword,  
    FROM dbo.tblx
    @uncryptpassword is set to ABC123'

    the select works for all other entries where an apostrophe is not set.

    thanks in advance

  • ok, managed to get this working by doing a replace on the parameter to replace ' with ''

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply