Convert subsequent SQL to case insensitive in SQL Server

78 Views Asked by At

We are converting from ASE (Sybase) to SQL Server (yay!)

Unfortunately, we have a ton of SQL built into our C# code which assumes ASE's default case insensitivity.

We are using ADO for both.

Is there something I can prepend in SQL to force all following queries in the batch to be case insensitive?

Is there something I can set on the ADO SqlDataReader to make the query run case insensitive?

Our DBA is very reluctant to change the collation on the db, the tables or the columns (ms = right, ase = wrong)

I know I can change the where clause in each to

WHERE 
    user_login_name COLLATE SQL_Latin1_General_CP1_CS_AS = :user_login_name 

instead of

WHERE user_login_name = :user_login_name

and that works.

I'm hoping to not have to modify every piece of SQL, so I'd like to make a change in the library code to make it all "just work" for all our existing code.

I can modify the C# code, or inject SQL at the top and or bottom of each query easily enough, but I'm open to other ideas.

0

There are 0 best solutions below