Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Finding the Final Slash in a file path;
DECLARE @FilePath nvarchar(300) = N'C:\Users\Andy\Documents\GitHub\dba-database\stored-procedures\dbo.Alert_Blocking.sql';
SELECT FilePath = @FilePath,
PathLen = LEN(@FilePath),
FinalSlashPos = CHARINDEX('\', REVERSE(@FilePath), 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment