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')
精彩评论