Monday, March 26, 2012

Remove a character from a string

Hi All,

Please guide me how to completely remove a particular character from a string in Sql Server 2000 and display remaining characters of the string.

Thanks in advance.

Regards
Prasanthideclare @.mytxt varchar(50)
set @.mytxt = 'abc123def'

--remove the 2 from the string
set @.mytxt = replace(@.mytxt, '2', '')
select @.mytxt|||Run this simple Query
this will Replace all s from the name field with blank

select replace(name,'s','') from sysobjects

No comments:

Post a Comment