日期:2014-05-18 浏览次数:20590 次
-- 比如 这个字符串 VLCT-28.ZML004N037-D01.MR.1ASE1YrSpcRule.FT1.551980057 ---我想要判断 Yr 在不在 上面的字符串中 ---如何 判断
if charindex('Yr','VLCT-28.ZML004N037-D01.MR.1ASE1YrSpcRule.FT1.551980057')>0
print '存在'
else
print '不存在'
------解决方案--------------------
declare @s varchar(100)=' VLCT-28.ZML004N037-D01.MR.1ASE1YrSpcRule.FT1.551980057'
if patindex('%Yr%',@s)>0
print 'Yr 在其中'
else
print '不在其中'
------解决方案--------------------
declare @s varchar(100)
SET @s=' VLCT-28.ZML004N037-D01.MR.1ASE1YrSpcRule.FT1.551980057'
if patindex('%Yr%',@s)>0
print '在'
else
print '不在'
if @s LIKE '%Yr%'
print '在'
else
print '不在'
if CHARINDEX('Yr',@s)>0
print '在'
else
print '不在'
/*
在
在
在
*/