和C#一样判断一个字符串中是否包含另一个字符串举例1:select charindex('test','This Test is test!!')->返回 6 (空格也算一个 下标从1开始)2:select charindex('test','This Test is test!!!',7) ->增加了开始检索的位置->返回 143:select charindex('test','This Test is Test'COLLATE Latin1_General_CS_AS)->返
场景如下,传入的id,如1,3,4,88.可以在.net后台处理,但是我更习惯在数据库中操作. 插入数据时可以这样处理,直接贴代码. CREATE PROCEDURE pro_CategorySave ( ) , @type INT , @TemplateID INT , @CategoryID INT ) AS BEGIN ) ; DELETE FROM GaituApp.dbo.TemplateRelationship WHERE TemplateID = @TemplateID AND T
declare @str nvarchar(50);set @str='462,464,2';select @str as '字符串'select len(@str) as '字符长度' select charindex(',',@str,1) as '第一个逗号的索引值' select LEFT(@str,charindex(',',@str,1)-1) as '第一个值' select SUBSTRING(@str,charindex(',',@str,1)+1,len(@str)) as
在工作中用到的例子: select * FROM [CSGDC.DataETLDB].[dbo].[StrategiesList] where strategy_name like '%基建系统%' and SUBSTRING(strategy_name,charindex('_',strategy_name,12)+1,100) in ( select SUBSTRING(strategy_name,charindex('_',strategy_name,12)+1,100) as strat