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
 Separating the string

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-08-25 : 01:39:26
Dear All,

I have a column with value FS\Atallam, I need to separate FS\ always,
and need to display only Atallam, how can we do this ?
Thanks

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-25 : 01:45:03
declare @str varchar(32)
select @str = 'FS\Atallam'
select substring(@str,charindex('\',@str,1)+1,len(@str))
select right(@str, len(@str) - charindex('\',@str,1))
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-08-25 : 01:51:49
Thanks a lot it worked out for me..
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-25 : 01:53:13
welcome
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-25 : 03:31:36
or

select PARSENAME(replace(@str,'\','.'),1)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -