Quantcast
Channel: Answers for "How To Query A Column For 2 Or More Repeating Characters?"
Browsing all 10 articles
Browse latest View live

Answer by RickD

You could use like for this:Where col LIKE '%#%#%'

View Article



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 Article

Answer 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 Article

Answer 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 Article

Answer 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


Answer by RickD

You could use like for this:Where col LIKE '%#%#%'

View Article

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 Article

Answer 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 Article


Answer 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 Article


Answer 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
Browsing all 10 articles
Browse latest View live


Latest Images