if object_id('pubs..tb') is not null
drop table tb
gocreate table tb(col ntext)
insert into tb(col) values('文字1')
insert into tb(col) values('文字2')
goupdate tb
set col = substring(col , charindex(']' , col) + 1 , charindex('[/' , col) - charindex(']' , col) -1)select * from tbdrop table tb
/*
col
------
文字1
文字2(所影响的行数为 2 行)
*/
drop table tb
gocreate table tb(col ntext)
insert into tb(col) values('文字1')
insert into tb(col) values('文字2')
goupdate tb
set col = substring(col , charindex(']' , col) + 1 , charindex('[/' , col) - charindex(']' , col) -1)select * from tbdrop table tb
/*
col
------
文字1
文字2(所影响的行数为 2 行)
*/
drop table tb
gocreate table tb(col ntext)
insert into tb(col) values('文字1')
insert into tb(col) values('文字2')
goupdate tb
set col = substring(col , charindex('htm]' , col) + 4 , charindex('[/url]' , col) - charindex(']' , col) -1)select * from tbdrop table tb/*
col
------
文字1
文字2(所影响的行数为 2 行)
*/
drop table tb
gocreate table tb(col ntext)
insert into tb(col) values('文字1')
insert into tb(col) values('文字2')
goupdate tb
set col = substring(col , charindex('htm]' , col) + 4 , charindex('[/url]' , col) - charindex('htm]' , col) - 4)select * from tbdrop table tb
/*
col
------
文字1
文字2(所影响的行数为 2 行)
*/
语句已终止。
文字2上面语句包含htm],[/url],我是利用的这两个东西.
这是你的数据,你的库中有不是这样格式的数据,可能会出错.最好给出所有类型的数据.
文字1 文字2 我是想将他们变成<a href=http://www.cc.com/032403.htm>文字1</a><strong>文字2</strong>
<img src=/images/news/upimg/2003429134556.jpg>不知能否实现
==>
<a href=http://www.cc.com/032403.htm>文字1</a>文字2 ==> <strong>文字2</strong>
==>
<img src=/images/news/upimg/2003429134556.jpg>就是这样的,现在就只要转换这几个,是将UBB代码转换成HTML的代码
计算条件列表并返回多个可能结果表达式之一。 CASE 具有两种格式: 简单 CASE 函数将某个表达式与一组简单表达式进行比较以确定结果。
CASE 搜索函数计算一组布尔表达式以确定结果。
两种格式都支持可选的 ELSE 参数。 语法
简单 CASE 函数:CASE input_expression
WHEN when_expression THEN result_expression
[ ...n ]
[
ELSE else_result_expression
ENDCASE 搜索函数:CASE
WHEN Boolean_expression THEN result_expression
[ ...n ]
[
ELSE else_result_expression
END