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
 General SQL Server Forums
 New to SQL Server Programming
 Replace Number/Special Characters by space

Author  Topic 

sqldbaa
Starting Member

32 Posts

Posted - 2009-09-02 : 09:36:35
Hi Experts,

Can any one let me know how to replace Number and Special Characters by space.

My table has a varchar field (Address) like

1 100 Washington Rd
E-8 Victory Apparment
1 Southwest St #201

How to get rid of the Number and Special Characters, as the data is passed as parameter to SP

And also, in full text search is it possible to search a Alpha Numeric field.

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-02 : 09:44:27
What is your expected result?

Madhivanan

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-09-02 : 09:44:46
something like:-

Declare @s varchar(100),@result varchar(100)
set @s='1 100 Washington Rd'
set @result=''

select
@result=@result+case when ascii(strval) BETWEEN 65 AND 90 OR ascii(strval) BETWEEN 97 AND 122 then strval else '' end from
(
select substring(@s,number,1) as strval from
(
select number from master..spt_values where type='p' and number between 1 and len(@s)
) as t
) as t1
SELECT @result
Go to Top of Page

sqldbaa
Starting Member

32 Posts

Posted - 2009-09-02 : 09:50:39
Thank You It is working.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-09-02 : 09:51:30
welcome
Go to Top of Page
   

- Advertisement -