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