Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: RE: sql_language digest: April 20, 2001


Message #1 by Bernard Omiple <BernardO@a...> on Sat, 21 Apr 2001 13:35:16 +0800
I tried doing some experiments.
I have used cast ( which could also work well with convert) and it 
actually works well.
Try something like :

---
/* this procedure makes a case-sensitive comparison of 2 text parameters */
create procedure comp_cs
	@var1 varchar(255),
	@var2 varchar(255)
as
if  cast(@var1 as varbinary(255))<> cast(@var2 as varbinary(255))
    return 0
else
    return 1
---



Use the stored procedure like 
--
declare 	@var integer,
		@txt1 varchar(255),
		@txt2 varchar(255)

/* assign values to @txt1 and @txt2 */

execute @var = comp_cs @txt1, @txt2

--

Please disregard some details of my earlier mail.
Sorry for any trouble but I really hope this will solve your problem.
I have tried this and you can modify it for your purpose. 
This procedure does not support wildcards but with modification, you can 
make it do so.



Thanks...


Bernard






-----Original Message-----
From: Bernard Omiple 
Sent: Saturday, April 21, 2001 11:48 AM
To: 
Cc: ''
Subject: RE: sql_language digest: April 20, 2001; case sensitive SQL
like


If you're using SQL Server...

Have you tried setting a case-sensitive sort order when you installed SQL 
Server?
You can check what sort order is set in your SQL server using sp_helpsort 
in Query Analyzer.
If the sort order installed is not case-sensitive, you may have to rebuild 
the master database which is quite delicate and must be handled really 
carefully - you know what I mean -  especially if you already have lots of 
user-defined databases installed; but it can be done. 

Setting a case-sensitive sort order makes all sorting and string 
comparisons case-sensitive for all databases installed in your server.


If you don't want to fiddle with the sort order, I have an idea but I have 
not tested this yet.
You may create a procedure that compares the binary values character for 
character in character strings. 
This makes search operations run slower, though.


Hope this helps...


Bernard

----------------------------------------------------------------------

Subject: Case Sensitive SQL LIKE
From: "Paul Broomfield" <Paul.Broomfield@t...>
Date: Fri, 20 Apr 2001 12:54:52 +0100
X-Message-Number: 2

Hi,

I asked this a little while ago - got an answer back but it didn't work.

What I want to be able to do is make SQL LIKE case sensitive.

The field type I am comparing is ntext, I have tried using CONVERT but I'm
not having much luck.

Has anyone got any pointers?

Thanks
Paul


  Return to Index