• Hi there,

    I'm not sure how Hasbytes works but I went on a hunch and here is my code

    DECLARE @tbl TABLE

    (UserName1 VARCHAR(100),

    UserName2 NVARCHAR(100))

    INSERT INTO @tbl

    SELECT 'avenue','avenue'

    --VARCHAR RESULTS

    select HashBytes('MD5', 'PW4' + 'avenue') as [password],

    'PW4' + 'avenue' as test

    select HashBytes('MD5', 'PW4' + UserName1) as [password],

    'PW4' + UserName1 as test

    FROM @tbl

    --NVARCHAR RESULTS

    select HashBytes('MD5', 'PW4' + N'avenue') as [password],

    'PW4' + N'avenue' as test

    select HashBytes('MD5', 'PW4' + UserName2) as [password],

    'PW4' + UserName2 as test

    FROM @tbl

    It seems that your table is storing the user name as a NVarchar

    however when you run it normally you using a varchar, so the results are different

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life