SQL line break not working

后端 未结 6 1356
梦如初夏
梦如初夏 2021-01-29 15:05

I have below code:-

DECLARE @NewLineChar AS CHAR(23) = CHAR(13) + CHAR(10)
select \'abc\'+@NewLineChar+\'a\'

I expect the result to be:-

<
6条回答
  •  清歌不尽
    2021-01-29 15:57

    U have to concat string with CHAR(13) This should work:

    DECLARE @NewLineChar NVARCHAR(200);
    SET @NewLineChar = 'abc' + CHAR(13) + 'a';
    PRINT @NewLineChar;
    

    OUTPUT:

    abc
    a
    

提交回复
热议问题