select id,replace(title,'asdf','') from table where title like '%asdf%'
select id,stuff(title,patindex('%asdf%',title),4,'') from table where title like '%asdf%'
select id,right(replace(title,'asdf','&'),len(replace(title,'asdf','&'))-charindex('&',replace(title,'asdf','&'))) from tb where title like '%asdf%'
select id,stuff(title,1,patindex('%asdf%',title)+3,'') from table where title like '%asdf%' 不好意思
use tempdb; /* create table [table] ( id int not null, title nvarchar(20) not null ); insert into [table](id,title) values (1,'测试asdf标题1'), (2,'23146asdf标题2'); */ select parsename(replace(title,'asdf','.'),1) as [内容] from [table] where title like '%asdf%';
select id,replace(title,'asdf','') from table where title like '%asdf%'
select id,stuff(title,patindex('%asdf%',title),4,'') from table where title like '%asdf%'
from tb where title like '%asdf%'
select id,stuff(title,1,patindex('%asdf%',title)+3,'') from table where title like '%asdf%'
不好意思
use tempdb;
/*
create table [table]
(
id int not null,
title nvarchar(20) not null
);
insert into [table](id,title)
values
(1,'测试asdf标题1'),
(2,'23146asdf标题2');
*/
select parsename(replace(title,'asdf','.'),1) as [内容]
from [table]
where title like '%asdf%';