Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need to remove empty spaces in string

Author  Topic 

veparala
Starting Member

30 Posts

Posted - 2006-09-27 : 10:40:09

I would like to remove empty spaces in String variable. Can anybody help me?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-27 : 10:45:51
Use REPLACE function:

Select Replace('this has too many  spaces', ' ', '')


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

veparala
Starting Member

30 Posts

Posted - 2006-09-27 : 11:49:50
Thanks. It is working
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-27 : 21:13:45
Also refer
http://sqlteam.com/forums/topic.asp?TOPIC_ID=56195

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sqlchiq
Posting Yak Master

133 Posts

Posted - 2008-08-15 : 12:33:52
What about converting empty string to text?

i have a column with empty entries

I tried...

replace(column, '', 'notavail')

but the empty entries are still empty
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-15 : 12:47:51
quote:
Originally posted by sqlchiq

What about converting empty string to text?

i have a column with empty entries

I tried...

replace(column, '', 'notavail')

but the empty entries are still empty


by empty entries do you mean empty space?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-18 : 02:58:31
quote:
Originally posted by sqlchiq

What about converting empty string to text?

i have a column with empty entries

I tried...

replace(column, '', 'notavail')

but the empty entries are still empty


SELECT CASE WHEN column='' THEN 'notavail' else column END from table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -