| 
	
 | 
 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] 
 |