July 4, 2009 at 4:19 am
sorry
July 4, 2009 at 4:42 am
Hi,
try this
create table #temp
(
text1 varchar(100)
)
insert into #temp
select '\VOL003\TEXT\0001\11400034_00000.txt'
union all
select '\VOL003\TEXT\0001\114000305_00000.txt'
union all
select '\VOL003\TEXT\0001\1140000036_00001.txt'
select replace(text1,'\VOL003\TEXT\0001\','') from #temp
Result
11400034_00000.txt
114000305_00000.txt
1140000036_00001.txt
ARUN SAS
July 4, 2009 at 9:24 am
Since the original poster deleted his post, I'm speculating (from the reply post) that he wanted to get just the file name from a full path filename.
A slightly better way to do this, in that this is not dependent on knowing the path in the first place, would be:
select reverse(left(reverse(text1), CharIndex('\', reverse(text1)) - 1))
from #temp
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
July 4, 2009 at 3:17 pm
mjarsaniya (7/4/2009)
sorry
May we ask why you felt compelled to delete the text of your post?
July 4, 2009 at 6:09 pm
mjarsaniya (7/4/2009)
sorry
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply