Empty string variable matching to LIKE conditions in SQL

前端 未结 2 1070
误落风尘
误落风尘 2021-01-20 04:17

I have a SQL Server table containing a nvarchar(max) column. I ran a query to select every row where this column contains the string \'remove\'. Amongst the res

2条回答
  •  孤城傲影
    2021-01-20 04:47

    My guess is that you have some control character(s) in the string. If the first character is a newline, for example, that may cause the rest not to be displayed.

    Try

    select item_id, unicode(content) 
    from objects
    where item_id = 100;
    

    This will show the unicode code point for the first character you can see the second character with:

    unicode(substring(item, 2, 1))
    

    and so on.

提交回复
热议问题