I have a program in which the user needs to login with user name and password.
I'm checking the name from the sys.syslogins
table in master db.
But for the password I receive a string with (probably) coded characters like this (1?????????????).
Now what can I do in order to decode that string and take the password in order to compare with the enter it one?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try this:
SELECT name FROM sys.syslogins
WHERE pwdcompare('somepassword', password) = 1
Edited to replace double quotes with single quotes.
回答2:
You can't decode sys.syslogins: it's a one way hash.
You compare like for like if it uses the same technique or run it through pwdcompare
Note: it's also sys.sql_logins in SQL Server 2005+
Also, why would you use SQL Server logins to validate a user? It doesn't make sense...