Hello, I have the following in a varchar field:
c:\temp\123.tif
c:\temp\124.tif
c:\temp\images\124.tif
c:\temp\images\today\125.tif
I would like to remove everything to the right of the last '\' so I end up with
c:\temp
c:\temp
c:\temp\images
c:\temp\images\today
I have been trying charindex, but it's not working out for me:
Can someone help me out with this?
Thanks!
c:\temp\123.tif
c:\temp\124.tif
c:\temp\images\124.tif
c:\temp\images\today\125.tif
I would like to remove everything to the right of the last '\' so I end up with
c:\temp
c:\temp
c:\temp\images
c:\temp\images\today
I have been trying charindex, but it's not working out for me:
Code:
select left(myfield, CHARINDEX( '\', reverse(myfield)))from mytable
Can someone help me out with this?
Thanks!