So I have the following:
SELECT
data,
encrypteddata,
CONVERT(varchar, DecryptByKey(encrypteddata)) AS 'decrypteddata'
FROM table
Given the key it outputs the original data column, encrypted data column and decrypted data column as a temp column. All good.
What I have been trying to do is get that result, and just make another AS column and say Match with true or false if it is a match or not.
I’ve tried
SELECT
data,
encrypteddata,
CONVERT(varchar, DecryptByKey(encrypteddata)) AS 'decrypteddata'
COUNT(distinct(decrypteddata))
FROM table
WHERE COUNT (distinct(decrypteddata)) > 1
GROUP BY data
This just gives me an error at the first COUNT about syntax.
Does anyone have a suggestion how I could do this?
try this
–Here you have used convert function-In this you have used just varchar without length parameter.So if you actual data is of more than 30 characters it will take only 30 characters and rest will be truncated.So just make sure what would be the length of your actual data.