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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need to remove empty spaces in string
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

veparala
Starting Member

30 Posts

Posted - 09/27/2006 :  10:40:09  Show Profile  Reply with Quote

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

harsh_athalye
Flowing Fount of Yak Knowledge

India
5581 Posts

Posted - 09/27/2006 :  10:45:51  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message  Reply with Quote
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 - 09/27/2006 :  11:49:50  Show Profile  Reply with Quote
Thanks. It is working
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22864 Posts

Posted - 09/27/2006 :  21:13:45  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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 - 08/15/2008 :  12:33:52  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 08/15/2008 :  12:47:51  Show Profile  Reply with Quote
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

India
22864 Posts

Posted - 08/18/2008 :  02:58:31  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000