I have a string \'some.file.name\',I want to grab \'some.file\'.
To do that,I need to find the last occurrence of \'.\' in a string.
My solution is :
This will also work:
DECLARE @test VARCHAR(100) SET @test = 'some.file.name' SELECT LEFT(@test, LEN(@test) - CHARINDEX('.', REVERSE(@test)))