Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ibanez270dx
Starting Member
3 Posts |
Posted - 2008-10-24 : 18:46:58
|
| Hello, I've been using MySQL for years, but I am developing an app that my boss would like to see using SQL Server 2005. I am trying do very basic authentication on my app. Basically, I want to do something like this in my login script:"SELECT * FROM auth_users WHERE username='@username' AND password=PASSWORD('@password')"where the PASSWORD() function (a MySQL thing) generates an irreversible hash password. I haven't found an equivalent in MSSQL... I tried using EncryptByPassPhrase() but it doesn't seem to want to work properly... I haven't used MSSQL before and I don't know what I'm doing wrong.Any and all help is appreciated!!!Thanks, - Jeff Miller |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-10-24 : 19:13:10
|
| [code]declare @test table (id int identity(1,1) not null primary key, passtest varbinary(255))insert into @test select pwdencrypt('password1') union allselect pwdencrypt('password2')union allselect pwdencrypt('password3')union allselect pwdencrypt('password4')select * from @testselect pwdcompare('password1',passtest) from @testin your caseselect * from auth_users where username = ... and pwdcompare(@password,password)=1[/code] |
 |
|
|
ibanez270dx
Starting Member
3 Posts |
Posted - 2008-10-25 : 19:13:18
|
| thank you! I finally got it working with your help :) |
 |
|
|
|
|
|