凌寒飘香

____成风破浪会有时,直把云帆济沧海!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

Create Table 留言表
(id Int,
 title Varchar(100),
 content Varchar(1000))
Insert 留言表 Select 1, 'A', 'ABC<img src="1.jpg" width=xx height=xx>zz'
Union All Select 2, 'B', 'dsad'
Union All Select 3, 'C', 'KKK<img src="2.jpg" width=xx height=xx>'
Union All Select 4, 'D', 'MM<img src="3.jpg" width=xx height=xx>'
Union All Select 5, 'E', 'KKK'

select * from 留言表
GO
--測試
Select id, title,
(Case When CharIndex('<img src', content) > 0 Then
Stuff(content, CharIndex('<img src', content), CharIndex('>', content, CharIndex('<img src', content) + 1) - CharIndex('<img src', content) + 1, '')
Else content End)  As content From 留言表
Gop

posted on 2007-07-30 10:16  凌寒飘香  阅读(168)  评论(0编辑  收藏  举报