标签:
-- ============================================= -- Author: jf_ou -- Create date: 2016/03/22 -- Description: 插相关配置到配置表 -- eg:
-- EXEC AddSysParametersForProjects ‘father‘, ‘son‘, ‘123, 1234, 12345, 123456‘, ‘,‘ -- ============================================= Create PROCEDURE AddSysParametersForProjects @varf nvarchar(50), --父参数 @vars nvarchar(50), --子参数 @strs nvarchar(max), --拼接的字符串 例如:‘12345,123456,12345678‘ @split nvarchar(1) --分割字符串的字符 AS BEGIN while(charindex(@split,@strs)<>0) begin select substring(@strs,1,charindex(@split,@strs)-1) --分别取得12345,123456,12345678 insert into Call(TelNum,CallerNum) values(substring(@strs,1,charindex(@split,@strs)-1),substring(@strs,1,charindex(@split,@strs)-1)) set @strs = stuff(@strs,1,charindex(@split,@strs),‘‘) --把已经取过的字符去除掉 end END GO
标签:
原文地址:http://www.cnblogs.com/oufeng/p/5304507.html