Created
December 3, 2021 14:53
-
-
Save timgaunt/fe72cebc022d5b2db04d52403d2731c5 to your computer and use it in GitHub Desktop.
Strip domain from url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
substring(Url, | |
(case when charindex('//', Url)= 0 then 1 else CHARINDEX('//', Url) + 2 end), | |
case | |
when charindex('/', Url, charindex('//', Url) + 2) > 0 then charindex('/', Url, charindex('//', Url) + 2) - (case when charindex('//', Url)= 0 then 1 else charindex('//', Url) + 2 end) | |
when charindex('?', Url, charindex('//', Url) + 2) > 0 then charindex('?', Url, charindex('//', Url) + 2) - (case when charindex('//', Url)= 0 then 1 else charindex('//', Url) + 2 end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment