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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Case-sensitive string compare in SQL 7.0

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-25 : 13:11:12
John writes "By default, I use case-insensitive collation for my databases. However, in come cases I want to do a case-sensitive comparison of two values. In SQL Server 2000, I can use:

SELECT @ID=ID FROM Logons
WHERE user_logon=@user_logon AND
password=@password COLLATE SQL_Latin1_General_CP1_CS_AS

This gives me case-sensitive comparison of passwords (I think, I haven't tested it). Unfortunately, COLLATE isn't supported in SQL 7.0, and our hosting provider uses SQL 7.0. I've been racking my brain to figure this out.

The only solution I can come up with is to pull the table's password into a variable and use ASCII(SUBSTRING(@table_password, @position, 1)) to loop through the password comparison. I presume there's a better solution??

Thanks,
John Crim"
   

- Advertisement -