sql server 语句

--create
-- SQL去除回车符,换行符,空格和水平制表符
create function RepSymbolChar(@str nvarchar(max))
returns nvarchar(max)
as
begin

set @str=LTRIM(@str)
set @str=RTRIM(@str)
set @str=replace(@str,char(9),'') --水平制表符
set @str=replace(@str,char(10),'') -- 换行    
set @str=replace(@str,char(13),'') --回车
return @str 
end
go
if exists(
SELECT top 1 * FROM pointsection where Content like '%<p>%' and Content not like '%"math-tex"%'
)
begin 
update pointsection set Content=dbo.RepP(Content) where Content like '%<p>%' and Content not like '%"math-tex"%'
end
--子查询更新
select *,(select  content from pointsection0907 where id=p.id)as c from pointsection as p
where Id in (select  Id from pointsection0907 where id=p.id and content like '%<p>%') and id=7863 
 

--update pointsection set content=(select content from pointsection0907 where id=pointsection.id)
--where Id in (select Id from pointsection0907 where id=pointsection.id and content like '%<p>%')
原文地址:https://www.cnblogs.com/Hangle/p/5836293.html