October 19, 2016 at 10:07 pm
I want to do this:
SELECT (CAST(DecryptByKey(LastName) AS NVARCHAR(200)) AS LastName + ', ' + CAST(DecryptByKey(FirstName) AS NVARCHAR(200)) AS FirstName) AS Name
I've tried many variations of this but I usually get the error :
The data types varbinary and varchar are incompatible in the add operator.
or sometimes - Syntax error near AS.
So how do you do this? (SQL Server 2014)
Doug
October 20, 2016 at 1:58 am
Removing the 'As Lastname' and 'AS Firstname' words should fix it
October 20, 2016 at 2:08 am
I've tried this before and just tried again, but I still get the same error - The data types varbinary and varchar are incompatible in the add operator.
October 20, 2016 at 2:29 am
Apologies. You were right. It works correctly now.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply