I’m struggling to find the right functions with SQL Server 2008 to rectify any strings coming like: \\myserver\mydir1\dir2\test.txt or \\myserver2\dir1\dir2\dir3\test.txt.
At the end, the result should appear like: \\myserver\mydir1\dir2 or \\myserver2\dir1\dir2\dir3 , So after the last "\" , the substring should be removed.
Any idea how to do that?
Logic:
\\myserver\mydir1\dir2\test.txttxt.tset\2rid\1ridym\revresym\\2rid\1ridym\revresym\\\myserver\mydir1\dir2You don’t need to know the LEN of the string for the SUBSTRING so just use 8000
Edit, after comment about using 8000