Get everything after and before certain character in SQL Server February 2, 2023 by Tarik use the following function left(@test, charindex("https://stackoverflow.com/", @test) - 1)