I am having trouble recording a stored procedure that first checks the hashed password for the password provided by the user (also the hashed one). If the passwords match, the procedure will change the password to a new password, which will be provided by the user for hashing before saving. I took a hit on him and included the code below, which seems completely outside the correct syntax. Any help that could be delivered would be greatly appreciated. Below is the code:
Create Proc UserChangePassword
@pGuid varchar(50),
@pOldPassword varchar(100),
@pHashedPassword varchar (100),
@pNewPassword varchar(10)
AS
set @pHashedPassword = HASHBYTES('md5', @pOldPassword)
set @pOldPassword as select st01Password from st01UserData where @pGuid = st01GUID
If ( @pOldPassword = @pHashedPassword)
Begin
Update st01UserData (
set st01Password = HASHBYTES('md5', @pNewPassword))
where st01GUID = @pGuid
Return 'SUCCESS'
Else
RETURN 'FAILED'
GO
source
share