Hashbytes comparison in stored proceduring not matching record

Posted by Michael Itzoe on Stack Overflow See other posts from Stack Overflow or by Michael Itzoe
Published on 2010-01-12T17:38:49Z Indexed on 2010/05/17 2:30 UTC
Read the original article Hit count: 224

The password field in my user table (SQL Server 2008) is encrypted using HASHBYTES on insertion. I have a stored procedure with parameters for the username and plain-text password which does a SELECT using that username and the password sent through HASHBYTES, then returns the user record if it finds a match. The SP is always returning an empty recordset, but if I copy and paste just the SELECT from the SP to a new query window, it returns the matched record. There're no other statements in the SP. I'm missing something here; what is it?

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server-2008