如何在查询中添加换行符(Informix)?
我需要执行一个用换行符更新文本的查询。我尝试使用 \n
但它按字面插入“\n”。
示例:
update table set text = "first line\nsecond line"
我希望它将该文本显示为:
"first line
second line"
而不是 “第一行\n第二行”
。
当我使用 .NET 执行此操作时,它可以工作,但不能在存储过程上执行。
有谁知道该怎么做?
I need to do a query that updates text with a line break. I tried using \n
but it inserts "\n" literally.
Example:
update table set text = "first line\nsecond line"
I want it to show that text as:
"first line
second line"
and not as "first line\nsecond line"
.
When I do this with .NET it works, but not on a stored procedure.
Does anyone know how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能正在寻找函数 'ifx_allow_newline'。
或者,按照 OMG Ponies 的建议,您可能正在寻找软件包 'ascii ' 来自 IIUG 软件档案。 Informix 现在具有函数 ASCII() 和 CHR()内置。请注意,如果您使用旧版本的 Informix(
CHR()
的 11.50 - 11.70 之前的任何版本),这些函数将不可用,您需要考虑 IIUG 存档中的包。You might, perhaps, be looking for the function 'ifx_allow_newline'.
Alternatively, following the suggestion of OMG Ponies, you might be looking for the package 'ascii' from the IIUG Software Archive. Informix now has the functions ASCII() and CHR() built-in. Note that if you have older versions of Informix (anything before 11.50 — 11.70 for
CHR()
), these functions will not be available and you will need to consider the package from the IIUG archive.要在 SP 中使用“换行”字符:
To use a «new line» character inside a SP:
输入回车符和新行,就像 C# 中的 \r\n 一样。如果文本要导出到文档中的任何地方,您可能都需要两者,因为有时只是换行符 -\n char(10) - 由于一些我已经忘记/从未真正得到过的非常沉闷的原因而显示为框字符:- )
Puts in the carriage return and the new line like \r\n in C#. You might want both if the text is ever going to be exported into a document anywhere because sometimes just newline -\n char(10) - appears as a box character for some very dreary reason that I've forgotten/never really got :-)