↧
Answer by Nathan Skerl
You can also play with replace to "count" the number of characters like so: declare @s varchar(15) set @s = 'abc#def#ghi' if (len(@s) - len(replace(@s, '#', ''))) > 1 begin print 'more than one...
View ArticleAnswer by Dave P 1
Use the PATINDEX function with the pattern '%##%', this will pick up two or more #'s in the expression and return a non-zero value.
View ArticleAnswer by Dave P 1
I think I misunderstood your question. My previous post assumed you were looking for adjacent characters. This will do what you want: count the instances of @c in @in.CREATE FUNCTION dbo.fn_strcount (...
View ArticleAnswer by gangtom
update set numHases = len(replace(col, '#', '# ')) - len(col) This will give you the no. of hashes each cell has. Or to select rows with more than 2 hashes, select * from abc where len(replace(col,...
View Article