保持文本格式在SQL中 [英] Keep text formatting in SQL

查看:215
本文介绍了保持文本格式在SQL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本区域,将其内容插入到SQL表格中。有没有办法保持文本的格式,然后在HTML中使用它?

用< br />替换字符10和字符13



使用SQL时(注意进入)

  select replace('
test
test','
','< br />')


结果为< br /> test< br /> test


I have a text area that inserts its content into a SQL table. Is there a way to keep the formatting of the text and then use it in HTML?

解决方案

If you mean keep the Enters then replace the char 10 and char 13 with <br/>

When using SQL (note the enters)

select replace(' 
test
test','
','<br/>')

This results in <br/>test<br/>test

这篇关于保持文本格式在SQL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆