You are here: Re: Why cannot set Unicode string « MsSQL Server « IT news, forums, messages
Re: Why cannot set Unicode string

Posted by Thang on 09/19/06 10:56

Thank you.

Erland Sommarskog wrote:
> Thang (thangvq@gmail.com) writes:
> > See this code:
> > DECLARE @SQL nvarchar(4000)
> > SELECT @SQL = 'SELECT * FROM CUSTOMER WHERE CustomerName = N''Tr?n
> > T?n H?n'''
> > PRINT @SQL
> >
> > The result always is this:
> > SELECT * FROM CUSTOMER WHERE CustomerName = N'Tr?n T?n H?n'
>
> You forgot the N on the outer string, that is:
>
> SELECT @SQL = N'SELECT * ...H?n'''
>
> (Sorry my newsreader is not Unicode-capable, so it mangles your Vietnamese
> characters.)
>
> Without the N, the string is a varchar literal, and if your collation is
> not a Vietnamese one, the Vietnamese characters are replace by fallback
> characters.
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация