declare @t table([Name] varchar(10)) insert @t select 'adad/adad' insert @t select 'ad' insert @t select '456' insert @t select '/' select * from @t where [Name] not like '%/%' select * from @t where charindex('/',[name])<=0 select * from @t where patindex('%/%',[Name])<=0 效率都差不多
charindex('/',name)<=0 --建议用这个 select * from @t where [Name] not like '%/%' --肯定是最差的 select * from @t where charindex('/',[name]) <=0 select * from @t where patindex('%/%',[Name]) <=0 --这个还可以 但是用%就不好了_还可以接受
insert @t select 'adad/adad'
insert @t select 'ad'
insert @t select '456'
insert @t select '/'
select * from @t where [Name] not like '%/%'
select * from @t where charindex('/',[name])<=0
select * from @t where patindex('%/%',[Name])<=0
效率都差不多
charindex('/',name)<=0 --建议用这个
select * from @t where [Name] not like '%/%' --肯定是最差的
select * from @t where charindex('/',[name]) <=0
select * from @t where patindex('%/%',[Name]) <=0 --这个还可以 但是用%就不好了_还可以接受