简体   繁体   English

Raiseerror的突破点

[英]Breakline in Raiseerror

is there anyway to breakline and continue on next line in RaiseError? 反正有断线并继续在RaiseError的下一行吗? <br/> and /n aren't working <br/>/n不起作用

Below is my code: 下面是我的代码:

BEGIN
BEGIN TRY
    SELECT 16/0
END TRY
BEGIN CATCH
    WHILE(@Count != 0)
    BEGIN
        SET @MaterialName = (SELECT Material FROM #T WHERE Quantity = 0 AND ID = @Count)
        SET @MSG = 'Material %s was not offered.' 
        RAISERROR(@MSG,16,1,@MaterialName);
        SET @Count = @Count - 1
    END
END CATCH
END

I dont want to make changes in the data access layer, we only support web, not window app. 我不想在数据访问层中进行更改,我们仅支持Web,不支持window app。 I want each loop msg to be printed on next line using sql only. 我希望每个循环味精仅使用sql打印在下一行。 Is it possible? 可能吗?

I'm no pro in sql but I think this will help 我不是SQL专业人士,但我认为这会有所帮助

Char(10)

Inserts a new line break a good guide about it is here: https://www.itsupportguides.com/knowledge-base/sql-server/sql-how-to-insert-new-lineline-break-in-string/ 插入一个新的换行符,有关此问题的一个很好的指南在这里: https : //www.itsupportguides.com/knowledge-base/sql-server/sql-how-to-insert-new-lineline-break-in-string/

I've also seen \\n used before but I don't know if that can be used in your circumstance 我也曾经看过\\n ,但是我不知道这种情况是否可以在您的情况下使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM