Suppose,we have following URL as:-
http://www.dotnetfunda.com/interviews/postexamquestion.aspx?, and we have to extract
dotnetfunda.com from above URL,then write below query to get only website name
declare @Url as nvarchar(1000) = 'http://www.dotnetfunda.com/interviews/postexamquestion.aspx?';
Select substring(replace(@Url,'http://www.',''),0,charindex('/',replace(@Url,'http://www.',''))) as [Website Name]
Output:-
dotnetfunda.com