views:

70

answers:

2

Hello,

We inherited an application that was not originally designed to consume localized data (Localized strings like Russian/Japanese, Localized datetime formats, etc).

The original developers who worked on the project did not anticipate that there will be unicode strings. Although the table's datatypes support unicode characters (NVARCHAR, etc), some of their queries are not properly prefixed with N.

For instance:

select * from table where searchString like '%<search string here>%'

To make this work with Unicode strings:

select * from table where searchString like N'%<search string here>%'

We then decided that we will just have to manually prefix all the string literals with N but then we discovered, to our horror, the massive amount of queries EVERYWHERE.

So, my question is, is there a way to NOT put the prefix N in our queries but it would still work? Like telling SQL Server "Hey, please treat all strings as Unicode. Please don't make me tell you everytime. :)"

Regards, Ian

+1  A: 

In SQL Server 2000 and 2005, as far as I'm aware, no. Couldn't say about 2008, but suspect the same.

Chris J
+1  A: 

You can't. Its necessary for compatibility with ODBC/OLE drivers (so they wont try to do a codepage conversions).

Ray