在stuff函数中添加换行符 [英] Add a line break in stuff function
本文介绍了在stuff函数中添加换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在SQL中,我使用了Stuff函数来获取数据库中的值,如图所示,
20.00,50.00,30.00
但在显示时我想显示不同行中的值,如:
20.00
50.00
30.00。
我知道我应该在前端格式化它但有没有任何方法SQL方面这是紧急要求,我不想为此改变我的MVC代码。
我试过,CHAR(10),CHAR( 13),CHAR(10)+ CHAR(13),CHAR(13)+ CHAR(10)。
这些都不起作用。
Hi,
In SQL, I have used Stuff function to get the values from the database as shown,
20.00,50.00,30.00
But while showing I want to show the values in different rows like:
20.00
50.00
30.00.
I know I should format it on the front end but is there any method on SQL side to do this as it's urgent requirement and I don't want to change my MVC code for this.
I have tried, CHAR(10), CHAR(13), CHAR(10)+CHAR(13), CHAR(13)+CHAR(10).
None of these things work.
推荐答案
不幸的是,没有适合所有系统的解决方案:你需要在表示层执行它,就像某些系统一样,它只有CR,其他只有NL,其他CR + NL,以及对于HTML它是< br />
SQL deosn't - 并且不能 - 知道它将去哪里,所以没有单一的解决方案你可以做到这一点。
对不起 - 但在前端做起来应该不会太难!
Unfortunately, there is no solution that will fit all systems: you need to do it at the presentation layer as for some systems it's CR alone, others NL alone, others CR+ NL, and for HTML it's <br />
SQL deosn't - and can't - know where it's going to go, so there is no single solution you can do that will work.
Sorry - but it shouldn't be too difficult to do in the front end!
这篇关于在stuff函数中添加换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文