SELECT C.Title FROM table C WHERE C.Title LIKE '%手机%' 我想直接在SQL中把 含有手机两个值的标题替换成:如 网上手机市场大丰收 替换成 网上<font style="color:red">手机</font>市场大丰收是替换查询出来的结果,而不是原本的内容,主要是想实现高亮显示.麻烦各位老师了
update C set Title = replace(Title '手机', '<font style="color:red">手机</font>') where Title LIKE '%手机%'
貌似差个逗号,嘿嘿 update C set Title = replace(Title ,'手机', '<font style="color:red">手机</font>') where Title LIKE '%手机%'
select replace(Title,'手机', '<font style="color:red">手机</font>') title from c where Title LIKE '%手机%'
SELECT C.Title FROM table C WHERE C.Title LIKE '%手机%' 我想直接在SQL中把 含有手机两个值的标题替换成: 如 网上手机市场大丰收 替换成 网上 <font style="color:red">手机 </font>市场大丰收 是替换查询出来的结果,而不是原本的内容,主要是想实现高亮显示. 麻烦各位老师了 ------------------------------------------------------search select replace(title , '手机' , '<font style="color:red">手机 </font>') title from tb
--update update tb set title = replace(title , '手机' , '<font style="color:red">手机 </font>')
declare @t table (a varchar (202)) insert into @t select '个值的标题替换成: ' insert into @t select '个值的标手机换成: ' insert into @t select '个手机换成: ' select replace(Convert(varchar(1000),a) ,'手机','<font style="color:red">手机</font>') from @t where a like '%手机%' /* 个值的标<font style="color:red">手机</font>换成: 个<font style="color:red">手机</font>换成: */
--search select replace(title , '手机' , ' <font style="color:red">手机 </font>') title from tb
--update update tb set title = replace(title , '手机' , ' <font style="color:red">手机 </font>')
update C set Title = replace(Title ,'手机', '<font style="color:red">手机</font>') where Title LIKE '%手机%'
C.Title
FROM
table C
WHERE
C.Title LIKE '%手机%'
我想直接在SQL中把 含有手机两个值的标题替换成: 如 网上手机市场大丰收 替换成 网上 <font style="color:red">手机 </font>市场大丰收 是替换查询出来的结果,而不是原本的内容,主要是想实现高亮显示. 麻烦各位老师了
------------------------------------------------------search
select replace(title , '手机' , '<font style="color:red">手机 </font>') title from tb
--update
update tb set title = replace(title , '手机' , '<font style="color:red">手机 </font>')
insert into @t select '个值的标题替换成: '
insert into @t select '个值的标手机换成: '
insert into @t select '个手机换成: '
select replace(Convert(varchar(1000),a) ,'手机','<font style="color:red">手机</font>') from @t where a like '%手机%'
/*
个值的标<font style="color:red">手机</font>换成:
个<font style="color:red">手机</font>换成:
*/
select replace(title , '手机' , ' <font style="color:red">手机 </font>') title from tb
--update
update tb set title = replace(title , '手机' , ' <font style="color:red">手机 </font>')