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
 only alphabat show

Author  Topic 

immad
Posting Yak Master

230 Posts

Posted - 2015-04-08 : 05:27:11
hi,
my data is like this

SalesPerson
aw.ab998
11abb.ia
aa
111a

i want data looks like this
SalesPerson
awab
abbia
aa
a

i want to remove numbers and dot through query

thanks for the help


immad uddin ahmed

satheesh
Posting Yak Master

152 Posts

Posted - 2015-05-06 : 10:02:39
Try this

select REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE
('aw.ab998','1',''),'2',''),'3',''),'4',''),'5',''),'6',''),'7',''),'8',''),'9',''),'0','')
,'!',''),'@',''),'#',''),'$',''),'%',''),
'^',''),'&',''),'*',''),' ',''),'.','')
Go to Top of Page

akibintel
Starting Member

7 Posts

Posted - 2015-06-15 : 06:17:46
Create Function [dbo].[RemoveNonAlphaCharacters](@Temp VarChar(1000))
Returns VarChar(1000)
AS
Begin

Declare @KeepValues as varchar(50)
Set @KeepValues = '%[^a-z]%'
While PatIndex(@KeepValues, @Temp) > 0
Set @Temp = Stuff(@Temp, PatIndex(@KeepValues, @Temp), 1, '')

Return @Temp
End

Thanks & Regards
Go to Top of Page
   

- Advertisement -