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
 character wild search?????

Author  Topic 

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2006-09-25 : 05:57:48
hello..
How i can wild search for character from A to Z in string??

declare @Str varchar(100)
set @Str = '1234adb6789iok'

select patindex??????

my output shuold be adbiok

T.I.A

nr
SQLTeam MVY

12543 Posts

Posted - 2006-09-25 : 06:03:56
see http://www.nigelrivett.net/SQLTsql/RemoveNonNumericCharacters.html
If you are using v2005 you can so it in a single statement probably.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2006-09-25 : 07:48:07
thanks...for it

can you pls tell me how i search for alphabet in alphanumeric string

declare @s varchar(20)
set @s = '123ertgh678'

select @s????

my output should look like

ertgh

T.I.A
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-09-25 : 08:37:14
did you look at the link?

select @s = '1234adb6789iok'

select @i = patindex('%[^a-zA-Z]%', @s)
while @i > 0
begin
select @s = replace(@s, substring(@s, @i, 1), '')
select @i = patindex('%[^a-zA-Z]%', @s)
end

select @s


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2006-09-26 : 09:26:55
hey!!!

Thank you very much!!!! :) :)

Go to Top of Page
   

- Advertisement -