【问题标题】:SQL Server Problem with carriage splitting a stringSQL Server 用回车分割字符串的问题
【发布时间】:2020-07-07 03:21:22
【问题描述】:
DECLARE @Description2 VARCHAR(MAX);

SELECT @Description2 = '1. Each week there will be a philosophical question to address. For example, you will address questions such as do we have freewill or are we determined?, what does quantum physics tell us about the nature of reality?, and what are the philosophical implications of Darwinian evolution? Utilizing the readings for the week prepare a written essay response. There will be a minimum of ten mini-essays for the term and each must be a minimum of 200 words.
2. Develop an argument on the topic of ontology, focusing specifically on the question "Are we just the brain?" Argue either the materialist position (we are just the brain) or the non-materialist position (we are not just the brain), drawing from the primary writings of the philosophers. Be sure to explain both positions in your essay and then make the case for the position you are supporting. This argumentative essay needs to be at least 750 words in length. We will then conduct an in class debate and you will need to argue your point in a debate setting.
3. Develop an argument in the area of ethics, arguing for or against animal rights. Make sure to utilize primary writings in the construction of your argument. This argumentative essay needs to be at least 750 words in length. Students will present their position to the class in a ten minute oral presentation.
4. Having read the writings of Epictetus and Sartre compare and contrast Stoicism and Existentialism. Write a 750 word essay highlighting the key differences and similarities.
5. Analyze the primary readings of Nietzsche in journal form. Choose 10 separate passages to analyze and include the following: a) a summary of the passage; b) an interpretation or analysis of the argument; c) a comparison and/or contrast to the ideas of another philosopher or philosophy; d) personal insight into the writing by applying the ideas to you or to the world at large (its meaning on a deeper, more personal level). This journal will be at least 1000 words in length. '

set @Description2 = replace(replace(replace(replace(replace(replace(replace(@Description2,'<p>',''),'</p>',''),'<br />',''),'&nbsp;',''),'<br />.<br />',''),'<div>',''),'</div>','')
set @Description2 = concat('???',REPLACE(@Description2,CHAR(13)+char(10),'???'))

select ltrim(s.Item)
from dbo.DelimitedSplit8K_LEAD(@Description2, '???') s
where ltrim(s.Item) <> ''

【问题讨论】:

  • 嗨,欢迎来到 SO。你能详细说明你有什么问题,你得到的实际输出(一个小版本就可以)和预期的输出

标签: sql-server string split


【解决方案1】:

那么你真正想要发生什么?你看到的和你想要的不一样?

在 SSMS 中,如果您转到工具 > 选项 > 查询结果 > SQL Server > 结果到网格,则有一个标记为“在复制或保存时保留 CR/LF”的复选框,它决定了当您单击时如何处理 varchar 数据在输出网格结果上并复制数据。

如果您选中该复选框,则将保留回车/换行。即,如果你这样做:

select 'a
b'

运行该查询,从网格中复制结果,并将其粘贴到记事本中,您将在记事本中获得 2 行文本。

另一方面,如果你不勾选复选框,你只会在记事本中得到一行。

请注意,如果您更改此复选框的设置,我相信您需要打开一个新的查询窗口才能看到新的行为。

请注意,这仅控制 SSMS 的行为。它与您的数据如何“真正”存储无关,例如,如果您将其插入表中。如果您有一个应用程序从表中读取数据,那么格式化输出的方式取决于应用程序。

【讨论】:

    猜你喜欢
    • 2015-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多