Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2008, 07:31 PM
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default capturing hashbytes output

I have a hashbytes program that runs fine. If I print the hashbytes('md5',@string) to screen, it is perfect. I need to capture this value to put in a column via update. I want to store the value as it looks on the screen..character, not binary. But this output IS binary and generally looks like: 0xFIWEHTO83290JF92JSU2940J2FIWEHTO. I want to capture this AS CHARACTERS "FIWEHTO83290JF92JSU2940J2FIWEHTO" to save in a c(32) column. Thoughts?
 
Old December 22nd, 2008, 04:31 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was not aware HASHBYTES function could return other characters than 0-9 and a-f.
 
Old January 6th, 2009, 06:12 PM
Registered User
 
Join Date: Jan 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was looking for the same.
I found this solution from http://stackoverflow.com/questions/2...tes-to-varchar
Code:
SELECT SUBSTRING(master.dbo.fn_varbintohexstr(HashBytes('MD5', 'HelloWorld')), 3, 32)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing Output Parameter Value GailCG SQL Server 2005 1 November 19th, 2008 08:52 AM
Signal Capturing by C# Somesh C# 0 December 22nd, 2006 06:06 AM
capturing activity ozPATT Access VBA 2 December 21st, 2005 09:20 AM
Capturing cmd output Chris Beach C# 0 October 3rd, 2003 04:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.