SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Update query how to Update a column getting values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cplusplus
Aged Yak Warrior

540 Posts

Posted - 07/16/2007 :  11:49:39  Show Profile  Reply with Quote
Can you please help, how to update a table column(HashPwd) getting all data from the same table another column(password), but convert to MD5 Hash(binary) from varchar data from the column password same table.


update myusertable set HashPWD = @password


Thank you very much for the information.

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 07/16/2007 :  11:55:24  Show Profile  Visit SwePeso's Homepage  Reply with Quote
update myusertable set HashPWD = dbo.MyOwnFunctionThatConvertsPasswordToHashWithMD5(password)


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

cplusplus
Aged Yak Warrior

540 Posts

Posted - 07/16/2007 :  11:59:01  Show Profile  Reply with Quote
Hello Peso,
What is dbo.MyOwnFunctionThatConvertsPasswordToHashWithMD5?

quote:
Originally posted by Peso

update myusertable set HashPWD = dbo.MyOwnFunctionThatConvertsPasswordToHashWithMD5(password)


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 07/16/2007 :  14:06:58  Show Profile  Visit SwePeso's Homepage  Reply with Quote
That is the name of the function that converts plain password text to a MD5 hash.
There are commercial products for this, or you could write your own.


Peter Larsson
Helsingborg, Sweden

Edited by - SwePeso on 07/16/2007 14:07:37
Go to Top of Page

cplusplus
Aged Yak Warrior

540 Posts

Posted - 07/16/2007 :  14:20:21  Show Profile  Reply with Quote
Peso,
I tried to execute the update statement you provided me: but it does'nt recognize this dbo.MyOwnFunctionThatConvertsPasswordToHashWithMD5 at all.

is that a real function which is avaiable on SQL server or are you referring me to create a function for that purpose.

Thank you...

quote:
Originally posted by Peso

That is the name of the function that converts plain password text to a MD5 hash.
There are commercial products for this, or you could write your own.


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 07/16/2007 :  14:37:51  Show Profile  Visit SwePeso's Homepage  Reply with Quote
No, it is not a real function name available in SQL Server.
As I wrote before, you have to write this function for yourself, ot buy a commercial product.

Or search the great Internet with your favorite search engine looking for a function that does this conversion for you.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11751 Posts

Posted - 07/16/2007 :  14:58:59  Show Profile  Visit spirit1's Homepage  Reply with Quote
i've been using this with no problems at all:
http://www.codeproject.com/database/xp_md5.asp

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 07/16/2007 :  16:03:44  Show Profile  Reply with Quote
Since this is SQL Server 2005, it is probably easier to just use the built-in MD5 hash function.

declare	@HashIn	varchar(20)
select	@HashIn	= 'Hello world!'
select	MyHash = HashBytes('MD5', @HashIn)

MyHash
------------------------------------
0x86FB269D190D2C85F6E0468CECA42A20

(1 row(s) affected)


CODO ERGO SUM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000