User table password field

  • I want to create table name "App_Users" with follwoing fields

    1) auserid - bigint

    2) ausername - varchar(20)

    3) password --varchar(20)

    what data type should i used for password field so i can have folloing functionality

    1) sql login user can not view password by firing query

    select * from App_users

    2) my application should varify password when user enter it.

    Please guide me for designing table structure ?

    Thanks

  • You could use the SQL Server password encryption routine.

    Create table App_users

    ( auserid - bigint

    , ausername varchar(20)

    , EncryptedPassword varbinary(256)

    )

    Then, during the login process with a password, encrypt it and then compare to the value in the table.

    declare @Password Nvarchar(128)

    , @EncryptedPassword varbinary(256)

    set @Password = 'AB1gS3cr3t'

    set @EncryptedPassword = CAST( pwdencrypt( @Password ) as varbinary(256))

    select @EncryptedPassword

    SQL = Scarcely Qualifies as a Language

  • Very Thanks Carl Federl ,

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

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