Thursday, March 22, 2012

case insensitive searching in sql server 2000 when its case sensitive

Can someone point me to a tutorial on how to search against a SQL Server 2000 using a case insensitive search when SQL Server 2000 is a case sensitive installation?

thanks in advance.

You could use

SELECT A, B, C FROM TABLENAME WHERE UPPER(A) = UPPER(@.A)

Will have a look later

|||

Here you go:

http://sqlserver2000.databases.aspfaq.com/how-can-i-make-my-sql-queries-case-sensitive.html

This tutorial is for case sensitive. But you can easily make it case insensitive by change is CS to CI like this:

Change: COLLATE Latin1_General_CS_AS

To: COLLATE Latin1_General_CI_AS

|||

You can also use
SELECT A, B, C FROM TABLENAME WHERE A COLLATE Latin1_General_CI_AS = @.A COLLATE Latin1_General_CI_AS

The COLLATE forces a given collation.

No comments:

Post a Comment