masri999
3/9/2007 11:59:00 AM
create table #temp (string varchar(100))
insert into #temp values ('aa/aa//')
insert into #temp values ('//')
insert into #temp values ('aa//')
insert into #temp values ('4/5/6/7')
insert into #temp values ('bb/')
insert into #temp values ('abcd')
select case when
substring(replace(string,'//','/') ,len(replace(string,'//','/')),1 )
= '/'
then substring(replace(string,'//','/'),
1,len(replace(string,'//','/'))-1)
else replace(string,'//','/') end from #temp
drop table #temp
On Mar 9, 3:13 pm, "ciupaz" <luigi.zambe...@gmail.com> wrote:
> On 9 Mar, 11:12, "M A Srinivas" <masri...@gmail.com> wrote:
>
>
>
>
>
> > Try replace (string,'//','/')
>
> > On Mar 9, 2:57 pm, "ciupaz" <luigi.zambe...@gmail.com> wrote:
>
> > > Hi all,
> > > I have some strings like these:
>
> > > aa/aa//
> > > //
> > > aa//
> > > 4/5/6/7
>
> > > I want delete the character "/" when is at the bottom of the string,
> > > or the string is only /.
> > > So to obtain:
>
> > > aa/aa
> > > Null
> > > aa
> > > 4/5/6/7
>
> > > How can I get this?
>
> > > Thanks a lot.
>
> > > Luigi- Nascondi testo tra virgolette -
>
> > - Mostra testo tra virgolette -
>
> Ok, but (my fault) there are some case of
> bb/
> and I want to obtain
> bb- Hide quoted text -
>
> - Show quoted text -