我有一张表,其中一个字段需要进行清理。基本的表结构如下:
create table testComments(id int, comments text)
在评论栏中,有些行有太多的“回车”(char(13))和“换行”(char(10))。如果一行中有多个分组,我需要能够修改它。目前我拥有的基本选择语句如下:
select count(id)
from testComments
where comments like('%' + char(13) + char(10) + char(13) + char(10) + '%')
该查询将找到结果。
"This is a entry in the testComments crlf
crlf
In the comments field that works"
尽管查询不会找到以下列出的注释结果:
"This is an entry in the testComments crlf
crlf
crlf
That will not work"
上述数据的查询仅返回1个条目的计数。您有什么想法可以更改查询以返回2个计数吗?
ntext
、text
和image
数据类型将在未来的SQL Server版本中被移除。避免在新的开发工作中使用这些数据类型,并计划修改当前使用它们的应用程序。请改用nvarchar(max)
、varchar(max)
和varbinary(max)
。 - marc_sChar(10)
(lf)。 - GolezTrol