USE TEMPDB GO declare @hash varbinary (255) CREATE TABLE tempdb..h (id_num int, hash varbinary (255)) SET @hash = pwdencrypt('123') -- encryption INSERT INTO tempdb..h (id_num,hash) VALUES (1,@hash) SET @hash = pwdencrypt('123') INSERT INTO tempdb..h (id_num,hash) VALUES (2,@hash) SELECT TOP 1 @hash = hash FROM tempdb..h WHERE id_num = 2 SELECT pwdcompare ('123', @hash) AS [Success of check] -- Comparison SELECT * FROM tempdb..h INSERT INTO tempdb..h (id_num,hash) VALUES (3,CONVERT(varbinary (255), 0x01002D60BA07FE612C8DE537DF3BFCFA49CD9968324481C1A8A8FE612C8DE537DF3BFCFA49CD9968324481C1A8A8)) SELECT TOP 1 @hash = hash FROM tempdb..h WHERE id_num = 3 SELECT pwdcompare ('123', @hash) AS [Success of check] -- Comparison SELECT * FROM tempdb..h DROP TABLE tempdb..h GO |
Results
(1 row(s) affected) ------------------- 1 (1 row(s) affected) |