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)
 Storing case-sensitive keys

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-10 : 19:43:55
MarkW writes "Will SQL Server 7.0 consider the key value 007BOND to be a different and therefore unique key from 007Bond ? What would be the best datatype to use when storing such a value (the real key has 15 characters). I have searched and searched but in vain for an answer, regs Mark."

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-02-10 : 20:29:51
Hi

You could convert your data to varbinary and store it as that, then convert back to varchar when you want to read it.

Or use varbinary just for the comparison

i.e.


declare @key1 varchar(15)
Select @key1 = '007Bond'

declare @key2 varchar(15)
Select @key2 = '007BOND'


Select
Case
WHEN cast(@key1 as varbinary(15)) =
cast(@key2 as varbinary(15)) THEN 1

ELSE 0 END as DoesMatch



Damian
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-02-10 : 23:50:53
Thought this link will help you more http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=12792 .



--------------------------------------------------------------
"Happiness is not something you experience, it's something you remember."
Go to Top of Page
   

- Advertisement -