October 13, 2017 at 12:45 pm
Hi All,
I have a table with a varchar column. My requirment is to remove all the extra blank spaces between the words in each string.
Can anyone help.
Example.
create table t1
( c1 varchar(5000)
)
go
insert into t1
select 'Hello world '
union all
select ' Welcome to the universe '
union all
select ' This is sample test string'
go
Expected output should be like this.
select c1 from t1;
Hello world
Welcome to the universe
This is sample test string
Thanks,
Sam
October 13, 2017 at 1:49 pm
Actually, I think that the solution is something as the one presented here:
http://www.sqlservercentral.com/articles/T-SQL/68378/
Be sure to follow the links for the optimal solutions.
October 13, 2017 at 2:19 pm
Thanks a lot Luis and Thom for the suggestions.
October 14, 2017 at 2:41 am
Luis Cazares - Friday, October 13, 2017 1:49 PMActually, I think that the solution is something as the one presented here:
http://www.sqlservercentral.com/articles/T-SQL/68378/Be sure to follow the links for the optimal solutions.
You might be right there Luis. Difficult to tell when the OP might have posted large amounts of white space outside code IF markup. :hehe:
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
October 14, 2017 at 10:18 am
Luis Cazares - Friday, October 13, 2017 1:49 PMActually, I think that the solution is something as the one presented here:
http://www.sqlservercentral.com/articles/T-SQL/68378/Be sure to follow the links for the optimal solutions.
Exactly. Those links are in the "Prologue" of the article and are much faster than the one in the article. The discussion was an awesome demonstration of what this community can do when we get together.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply