开发者

CHAR function on SQL Server is returning different values on different servers

When I do

SELECT CHAR(193)

On my local database it returns Á, but when I do the same on a database running on another server it returns .

I expect Á as the correct value, how can I fix the func开发者_运维百科tion?

The databases were created individually, they aren't exactly the same.


Try using NChar instead of Char:

SELECT NCHAR(193)


The collation is not the same, run this to see that you get different answers

SELECT CHAR(193) collate SQL_Latin1_General_Cp1256_CI_AS  
SELECT CHAR(193)
SELECT CHAR(193) Latin1_General_CI_AS

to find out the collation for the database run this

Select DATABASEPROPERTYEX(DB_name(),'Collation')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜