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
 General SQL Server Forums
 New to SQL Server Programming
 only alphabat show
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

immad
Posting Yak Master

Pakistan
230 Posts

Posted - 04/08/2015 :  05:27:11  Show Profile  Reply with Quote
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

United Kingdom
152 Posts

Posted - 05/06/2015 :  10:02:39  Show Profile  Reply with Quote
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','')
,'!',''),'@',''),'#',''),'$',''),'%',''),
'^',''),'&',''),'*',''),' ',''),'.','')

Edited by - satheesh on 05/06/2015 10:03:29
Go to Top of Page

akibintel
Starting Member

India
7 Posts

Posted - 06/15/2015 :  06:17:46  Show Profile  Reply with Quote
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
  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.02 seconds. Powered By: Snitz Forums 2000