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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-31 : 09:29:24
|
| Mayur writes "I want to store usename & Password in a Sql table.Username is not a problem, but how to store Password with out tampering with their case sensivity.For eg. "abc" & "ABC" should not be the same." |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-01-31 : 09:37:10
|
| You can store the password as-is, but when you compare the password, CONVERT() them to varbinary first:DECLARE @pass1 varchar(10), @pass2 varchar(10)SELECT @pass1='HELLO', @pass2='Hello'SELECT CASE WHEN @pass1=@pass2 THEN 'Same' ELSE 'Different' END AS CaseInsensitive,CASE WHEN Convert(varbinary(16), @pass1)=Convert(varbinary(16), @pass2) THEN 'Same'ELSE 'Different' END As CaseSensitiveCheck Books Online for more details on the CONVERT function. |
 |
|
|
|
|
|