| Can we have something like LastIndexOf in SQL Server?
No we donot have such keyword in SQL. But to get solution we can make our custom query for this.
Below is the query
declare @filepath as varchar(1000)
set @filepath='c:\crackyourinterview\pages\default.aspx'
SELECT RIGHT(@filepath , CHARINDEX ('\' ,REVERSE(@filepath))-1) as FileName
| | |