declare @MyStr nvarchar(200)
SET @MyStr='a,b,c,d,e'
用 ",," 替换 "," 得出新长度 再减去原字符串长度 得出 "," 在字符串中出现在次数
SELECT len ( replace ( @MyStr , ' , ' , ' ,, ' ) ) - len ( @MyStr )
declare @MyStr nvarchar(200)
SET @MyStr='a,b,c,d,e'
用 ",," 替换 "," 得出新长度 再减去原字符串长度 得出 "," 在字符串中出现在次数
SELECT len ( replace ( @MyStr , ' , ' , ' ,, ' ) ) - len ( @MyStr )