最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sql - String Comparisons dropping the values of the string - Stack Overflow

programmeradmin5浏览0评论

I am working on the insertion of addresses and other info for a database where addresses can be from multiple countries or in other languages. Below is a summary of what I am doing.

DECLARE @AddressLine1 NVARCHAR(70),

@AddressLine2 NVARCHAR(70)

SELECT TOP 1

@AddressLine1 = NULLIF(l.i_address1, ''),

@AddressLine2 = NULLIF(l.i_address2, '') FROM mytable

From there I'm doing more processing down the line. I haven't had an issue with importing the data until I started doing imports with data in the Amharic language. An example would be the value "ወደ አደረገ፣ አድራሻ ጻፈ".

When I use NULLIF on values such as that, the value gets dropped to an empty string and the variable gets a value of NULL. If I don't use NULLIF, the variable gets assigned the string. The only way I've been able to find a fix for this is when I collate the field to Latin1_General_BIN. (NULLIF(l.i_address2 COLLATE Latin1_General_BIN, ''))

My thought and question remains though... why does that specific string and other strings in the Amharic language break when using a string comparison function against it?

There's no hidden whitespace or characters and no leading/trailing spaces.

发布评论

评论列表(0)

  1. 暂无评论