Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to md5 pass column by command ?

Author  Topic 

bbboy
Starting Member

1 Post

Posted - 2007-07-20 : 05:02:25
Hi all, i have a database, the password column is normal format , and i want to update all the data in the column password to md5 format , can any one tell me what the command for me to do it ?

is this command will work ?

update tbl_MEMBERS set clm_password=(md5(clm_pass) where id<100

any one have ideas how to do it?

bbboy

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-07-20 : 13:34:21
You want to store the MD5 Hash?

Here is a sample from BOL:[CODE]DECLARE @HashThis nvarchar;
SELECT @HashThis = CONVERT(nvarchar,'mypassword');
SELECT HashBytes('MD5', @HashThis);[/CODE]So I think you could do something like:[CODE]UPDATE tbl_MEMBERS
SET clm_password = HashBytes('MD5', clm_pass)
WHERE id < 100[/CODE]
-Ryan
Go to Top of Page
   

- Advertisement -