CREATE
FUNCTION
[dbo].[f_trimstr] ( @str NVARCHAR(
MAX
) )
RETURNS
NVARCHAR(
MAX
)
AS
BEGIN
WHILE CHARINDEX(
'<'
, @str) > 0
SET
@str = STUFF(@str, CHARINDEX(
'<'
, @str),
CHARINDEX(
'>'
, @str) - CHARINDEX(
'<'
, @str) + 1,
''
)
RETURN
@str;
END
调用:
结果:![](https://img-bbs.csdn.net/upload/201706/16/1497594717_886573.jpg)
1
|
SELECT dbo.f_trimstr(html) FROM dbo.Test |
结果:
![](https://img-bbs.csdn.net/upload/201706/16/1497594717_886573.jpg)