What is the Null Character literal in TSQL?

前端 未结 6 1885
暖寄归人
暖寄归人 2020-11-27 18:49

I am wondering what the literal for a Null character (e.g. \'\\0\') is in TSQL.

Note: not a NULL field value, but the null character (see link).

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 19:49

    Are you certain they are null characters? How did you get them in there?

    It looks like SQL Server treats them as string terminators. This query:

    select 'aaa' + char(0) + 'bbb'
    

    Returns aaa for me (on SQL Server 2008).

    Edit: Above is wrong - it's just the results grid that treats them that way. They show up in text mode.

提交回复
热议问题