T-SQL Question
Try this. I use something similar for counting the number of commas in a string.--drop table ast create table ast (field1 varchar(128)) insert into ast select '000' union select '*111' union select...
View ArticleT-SQL Question
Create Table #Foo(MyData varchar(20)); Insert #Foo(MyData) Values ('a*b*c*'), ('a*b'), ('a*b*c*d'), ('a*b*c*d*e*f'); ;With cte As (Select MyData, Len(MyData) - Len(Replace(MyData, '*', '')) As...
View ArticleT-SQL Question
create table test (id int, col varchar(10)) insert into test values (1,'a*b*c*'),(2,'a*b'),(3,'*b*c*d') select col+ replicate('*',5-(len(col)-len(replace(col,'*',''))) ) from test drop table test
View ArticleT-SQL Question
Please read the form rules before you post. You fail to give us any DDL, not even the name of the table! CREATE TABLE Wacko (star_string VARCHAR (50) NOT NULL PRIMARY KEY CHECK (star_string LIKE...
View ArticleT-SQL Question
Could any one please answer my question:I'm trying to write a query for adding extra '*' based on the count of "*'s in a column.Ex:I have a data like this :a*b*c*a*ba*b*c*dI need 5 *'s for each row....
View Article