Thang (th*****@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,
es****@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx