Re: nvarchar notation accepted?

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: nvarchar notation accepted?
Date: 2010-05-14 10:06:54
Message-ID: C4DCBE98-5362-49C1-867B-864C4EB2D330@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On May 14, 2010, at 5:56 , Jaime Casanova wrote:
> On Thu, May 13, 2010 at 10:13 PM, Takahiro Itagaki
> <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>>
>> Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
>>
>>> i migrate a ms sql server database to postgres and was trying some
>>> queries from the application to find if everything works right...
>>> when i was looking to those queries i found some that has a notation
>>> for nvarchar (ej: campo = N'sometext')
>>
>> Do you have documentation for N'...' literal in SQLServer?
>> Does it mean unicode literal? What is the difference from U& literal?
>> http://developer.postgresql.org/pgdocs/postgres/sql-syntax-lexical.html
>>
>
> nop, only thing i found is about NVARCHAR:
> http://msdn.microsoft.com/en-us/library/ms186939.aspx but it has no
> examples about the N'' notation although you can find examples of it
> use here: http://msdn.microsoft.com/en-us/library/dd776381.aspx#BasicSyntax

Without using the N prefixed versions of CHAR, VARCHAR and string literals, MS SQL Server refuses to process characters other than those in the database's character set. It will replace all those characters with '?'.

Note that this is not an encoding issue - it will even do so with protocol versions (everything >= 7.0 I think) that use UTF16 on-wire, where those characters can be transmitted just fine.

best regards,
Florian Pflug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Takahiro Itagaki 2010-05-14 10:38:38 Re: Japanies translation breaks solaris build
Previous Message Florian Pflug 2010-05-14 09:46:01 Re: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle