怎么搜索出字段中含有“SD”,但是不是包含在“MSD”中的数据

bzscs 2006-04-27 04:27:33
如题
...全文
142 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
十一月猪 2006-04-27
  • 打赏
  • 举报
回复
select * from t
where charindex('SD',col) > 0
and charindex('MSD',col) = 0
xeqtr1982 2006-04-27
  • 打赏
  • 举报
回复
--这样?
declare @t table([string] varchar(10))
insert into @t select 'MSD'
insert into @t select 'SD1'
insert into @t select 'S31D1'
insert into @t select 'MSD31'
insert into @t select 'SD31'

select * from @t where charindex('SD',[string])>0 and charindex('MSD',[string])=0
WangZWang 2006-04-27
  • 打赏
  • 举报
回复
select * from tbl
where charindex('SD',col)>0 and charindex('MSD',col)=0

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧