17
Answers

Encrypted password is not saving in table column

Sivakumar

Sivakumar

9y
569
1
Hi,
 
This is my stored procedure :
 
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[uspAddMember]
@MemberName NVARCHAR(50),
@LoginName NVARCHAR(50),
@LoginPassword NVARCHAR(4000)
AS BEGIN

DECLARE @HashThis nvarchar(4000);
SET @HashThis = CONVERT(nvarchar(4000),@LoginPassword);

SELECT HASHBYTES('SHA2_256', @HashThis);



DECLARE @MemberID INT;

INSERT INTO Member(MemberName, LoginPassword)
VALUES(@MemberName, @HashThis);

SET @MemberID = SCOPE_IDENTITY();

INSERT INTO MemberLogin(MemberID, MemberLoginName)
VALUES(@MemberID, @LoginName);

RETURN @MemberID;

END
when I execute this procedure generate a encrypted password but not saving in table column.
Please give me a correct query for that.
 
Thank you.
Answers (17)