1

For example when using a SQL server database that has a default collation of case insensitive I can override that collation in a query to get a case sensitive comparison like so:

SELECT *
FROM MyTable
WHERE MyColumn LIKE '%test%' COLLATE SQL_Latin1_General_CP1_CS_AS

How would achieve the same thing in a Sybase database that is also set to default to case insensitive?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Dave Sexton
  • 10,768
  • 3
  • 42
  • 56
  • I'm not sure if this can be done without changing the sort order. There is a Dictionary Order, Case Sensitive, with Preference that may allow you to get the results you want without messing up where clauses that rely on case insensitivity. – Mike Gardner Mar 19 '13 at 15:35
  • Also, what Sybase product are you running? ASE? ASA? IQ? – Mike Gardner Mar 19 '13 at 15:36
  • ASA version 8 I think, connecting to it via SSIS. It is part of a third-party application and I can't make any changes to the database. One option might be to let SSIS do the filtering and just do a case insensitive prefilter in a query. The problem is that I am trying to correct some common errors in a text field and few involve just changing the case - therefore my rows to process would never decrease. – Dave Sexton Mar 19 '13 at 16:04

1 Answers1

0

This question is almost touching the tender age of 10 years, but is exactly what I was searching for. In my case I didn't need a like, but a simple equals:

SELECT *
FROM MyTable
WHERE MyColumn = 'test'
AND hash(MyColumn) = hash('test') -- hash('TEST') would be different

The hash() enforces case-sensitivity (and, yes, slows down the query tremendously!)

Simon
  • 2,994
  • 3
  • 28
  • 37