Re: selecting case sensitive values from MSAccess or SQL Server



not sure about Access, but with SQL Server you can specify a collation.
the performance will most likely be slower when specifying the collation (as indexes won't come into play), so if you know the collation of the server you're hitting, to improve performance you may want to leave off the collation, if it suits your query.



e.g.

-- using out-of-the-box pubs.authors table as example
-- case [and accent] insensitive
select *
from authors
where au_lname='white' collate SQL_Latin1_General_CP1_CI_AI

returns 1 row

-- case [and accent] sensitive
select *
from authors
where au_lname='white' collate SQL_Latin1_General_CP1_CS_AS

returns 0 rows



Joe wrote:

Hi

I have a bit of code which selects data from either a SQL Server or MS
Access data base and then creates a report, code example below.

My problem is how do i select distinct case sensitivity to return the proper
values that i need.

OR selecting an EXACT value = the exact value in the table

ex: tablefield = "JoHn"

Values in table:
John
jOhN
JOhn
joHN

should return 4 distinct values.


******** ******** CODE:

TheVariable = "JoHn"

lcTableName = "SELECT * FROM "+gcSQLString+"thetablename "+;
"WHERE fieldname = ?TheVariable "+;
"order by otherfield"

STORE SQLCONNECT(gcDataSource, 'dataconnection') TO gnConnHandle1
IF gnConnHandle1 > 0
= SQLSETPROP(gnConnHandle1, 'asynchronous', .F.)
= SQLSETPROP(gnConnHandle1, 'packetsize', 6096)

= SQLPREPARE(gnConnHandle1, lcTableName, 'TableName')

SELECT 2
= SQLEXEC(gnConnHandle1, lcTableName, 'TableName')

= SQLDISCONNECT(gnConnHandle1)
********
********

Any Help would be greatly appreciated

Joe



.



Relevant Pages

  • Re: Nearest Common Ancestor Report (XDb1s $1000 Challenge)
    ... but even MORE generic than the XDb1 implementation, ... disadvantage that 'john', 'John' and 'JOHN' are treated as three distinct ... Since this is the default collation, I assume that your database will use ... I have SQL Server on my desktop; ...
    (comp.object)
  • Re: SQL7: case sensitivity
    ... In SQL Server 7 you specify the collation on the SERVER level (this is ... changed in SQL Server 2000 where you can specify it down to column level). ... which is supposed to store filenames stored on a Unix ...
    (microsoft.public.sqlserver.programming)
  • RE: Advice on Create a SQL Server
    ... Use the default collation. ... domain, and running on a windows domain account, it is better to run under ... Windows Authentication mode. ... to SQL Server using a username/password. ...
    (microsoft.public.sqlserver.setup)
  • RE: Advice on Create a SQL Server
    ... Use the default collation. ... Mode" - it depends on how you will be connecting to your database. ... domain, and running on a windows domain account, it is better to run under ... to SQL Server using a username/password. ...
    (microsoft.public.sqlserver.setup)
  • Re: Installing SQL_Latin1_General_CP1_CI_AS collation order??
    ... Tibor Karaszi, SQL Server MVP ... "Ward Horsfall" wrote in message ... >> rebuildm.exe) interfaces and a collation designator, ...
    (microsoft.public.sqlserver.setup)