Aug 5, 2009 #1 JayKusch MIS Joined Oct 30, 2001 Messages 3,199 Location US Say I have a string of: R:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\model.mdf and I want to know the position of the last \ (which would be position 43). Thanks! Thanks J. Kusch
Say I have a string of: R:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\model.mdf and I want to know the position of the last \ (which would be position 43). Thanks! Thanks J. Kusch
Aug 5, 2009 #2 checkai Programmer Joined Jan 17, 2003 Messages 1,629 Location US http://www.sqlservercentral.com/scripts/T-SQL+Aids/31116/ Upvote 0 Downvote
Aug 5, 2009 #3 gmmastros Programmer Joined Feb 15, 2005 Messages 14,912 Location US Code: Declare @Test VarChar(100) Set @Test = 'R:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\model.mdf' Select Len(@Test) - CharIndex('\', Reverse(@Test)) -George "The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom Upvote 0 Downvote
Code: Declare @Test VarChar(100) Set @Test = 'R:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\model.mdf' Select Len(@Test) - CharIndex('\', Reverse(@Test)) -George "The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom