ColdFusion tutorial to create same hash as CF in MS SQL
ColdFusion tutorial to create same hash as CF, but in MS SQL!
How cool would it be, being able to create the same MD5 hash as ColdFusion, directly in the MS SQL RDMBSH?
I know there’s been quite some demand for this function, most people create the MD5 hash in ColdFusion and then pass it the Database, this mean a couple more round trips to the db, which we prefer to avoid at anytime.
We’ll make some assumptions in this article to make things easier, and they are;
- you are running MS SQL 2005
- you are running ColdFusion
Ready to get started?
The first thing to do is go into your MS SQL database and create the following function that creates the hash and return a string value.
CREATE FUNCTION [dbo].[fn_getHash] (
-- Add the parameters for the function here
@myString VARCHAR( 8000 )
)
RETURNS CHAR( 32 )
AS
BEGIN
-- Declare the return variable here
DECLARE @returnValue CHAR( 32 )
-- Add the T-SQL statements to compute the return value here
DECLARE @binaryValue VARBINARY( 255 )
SET @binaryValue = (SELECT hashBytes( 'MD5', CONVERT( VARCHAR, @myString ) ) )
DECLARE @characterValue VARCHAR( 255 )
DECLARE @i INT
DECLARE @length INT
DECLARE @hexadecimalString CHAR( 16 )
SELECT @characterValue = ''
SELECT @i = 1
SELECT @length = DATALENGTH( @binaryValue )
SELECT @hexadecimalString = '0123456789abcdef'
WHILE (@i ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- sql university of oklahoma
- gpis ihistorian implementation sql 2005
- table valued functions the key idea
- you want to create tables with sql because
- washington state university
- introduction claros data management hach
- sql azure tips and tricks johns hopkins university
- coldfusion tutorial to create same hash as cf in ms sql
- hands on lab building your first extract transform load
Related searches
- ms sql syntax checker
- ms sql export csv
- powershell create a hash table
- celebrity with the same birthday as me
- ms sql convert date to timestamp
- ms sql create table
- ms sql convert date to datetime
- ms sql create sequence
- ms sql select top
- ms sql convert numeric to string
- how to create tutorial video
- sql how to create database