Data table: people_t
Columns:
Username - nvarchar(200)
PasswordHash - nvarchar(1000)
Query:
I want to change multiple passwords of type hash to be the usernames. After the command, the passwords should still be hashed but the actual password will be the user's username. E.g.
- Username: johndoe
- PasswordHash: iamjohn
Will become:
- Username: johndoe
- PasswordHash: johndoe
I am trying the following:
DECLARE @UserPass SHA1 --Var for storage of username
SET @UserPass=UserName --Add current Username's to UserPass var
UPDATE people_t --Update the people_t
SET PasswordHash=@UserPass --Do the job
Do I even need a WHERE clause or what am I doing wrong here?
Thanks in advance folks.