1

In Microsoft SQL Server, trying to put double byte characters into a string in the query will mess up the double byte strings unless there is an N front of the string, like this:

SELECT 'double-byte string'    -- puts question marks if string is double-byte
SELECT N'double-byte string'   -- works with double-byte strings

The question is: is there any way to make N the implicit default so I don't have to put N in front of every string?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Emre
  • 1,239
  • 9
  • 7
  • 4
    No. String literals in TSQL without the `N` prefix are always treated as `varchar` in the code page of the default collation. – Martin Smith Jun 11 '12 at 13:58
  • 1
    I'd also add that this shouldn't be a problem unless you are talking about SQL Server Manager, because in code you should be using parameterized SQL. – Chris Shain Jun 11 '12 at 16:08
  • No, you can't make it the default. See my answer here: http://dba.stackexchange.com/a/20546/2718 – Jon Seigel Jul 21 '12 at 13:28

0 Answers0