Encrypt Function Problem

  • patilds

    SSChasing Mays

    Points: 615

    Hi

    I have a login table with following fields and data

    Login

    LoginID varchar(8)

    Password varchar (8)

    The Data is table is

    Loginid Password

    Bill Gates

    Tick Tick123

    Now if I am running the query :

    select * from login where loginid='Bill' and Password=ENCRYPT('GATES'), the query works.

    It should not work as the data in password field is not encrypted and both should not match.

    Can anybody will provide the answer?

    Thanks

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 715835

    I ran this:

    create table Logins

    (

    LoginID varchar(8),

    [Password] varchar (8)

    )

    go

    insert logins select 'Bill', 'Gates'

    insert logins select 'Tick', 'Tick123'

    go

    select * from logins

    go

    select * from logins where loginid='Bill' and [Password]=ENCRYPT('GATES')

    go

    drop table Logins

    No rows returned for the second query.

    Steve Jones

    steve@dkranch.net

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply