Home Forums SQL Server 2008 T-SQL (SS2K8) Remove characters after last slash in string RE: Remove characters after last slash in string
raym85
SSC Eights!
Points: 938
More actions
March 25, 2013 at 10:52 am
#1600424
if you always know the len of the extnetion this should work as well without being so taxing.
declare @string varchar (100)
set @string = 'x:\folder1\folder2\folder3\test.txt'
select SUBSTRING(@string,1, LEN(@string)-8)