I was creating a stored procedure in SQL Server and I missed this conversion error. "Implicit conversion from data type to varbinary is not allowed. Use the CONVERT function to run this query."
The idea is to encrypt and decrypt passwords.
CREATE PROCEDURE sp_Login @email VARCHAR(30), @pass VARCHAR(25)
AS
DECLARE @PassEncode VARBINARY(8000)
DECLARE @PassDecode VARCHAR(25)
DECLARE @result BIT
BEGIN
SELECT @PassEncode = contraseña FROM Usuario WHERE email = @email
SET @PassDecode = DECRYPTBYPASSPHRASE('password', @PassEncode)
END
BEGIN
IF @PassDecode = @Pass
BEGIN
SET @result=1
SELECT @result
END
ELSE
BEGIN
SET @Result=0
SELECT @result
END
END
Go
From what I read I have to use "CONVERT" but I do not know where.