【发布时间】:2020-02-14 08:48:47
【问题描述】:
我需要从该文本中提取前 6 行,然后使用 select 语句提取其余行,我使用的是 SQL Server 2016。
Hi,
this is an
example
text to
extract the
first 6 lines
and then extract
the rest,
thanks
SELECT '6 first lines', 'rest lines'
结果:
第 1 栏:
Hi,
this is an
example
text to
extract the
first 6 lines
第 2 栏:
and then extract
the rest,
thanks
【问题讨论】:
-
你尝试了什么,为什么没有成功?分隔符是 CRLF,还是只是 LF?
-
“此文本”在您的数据库中存储在何处以及如何存储?是否在每个换行符一行的表格中?它是查询窗口中的内联文本复制粘贴吗?
-
@GeorgeMenoutis 它存储在带有 char(13) 行跳转的 nvarchar 列中
-
只是一个回车,没有换行(以及)?
-
它必须有一个换行符。你也试过吗?
标签: sql sql-server stored-procedures substring sql-server-2016