Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Get the Domain Name, Page Name and Query Parameter from a URL

DECLARE @URL    VARCHAR(1000)
SET @URL = 'http://www.sql-server-helper.com/tips/tip-of-the-day.aspx?tid=58'

SELECT SUBSTRING(@URL, 8, CHARINDEX('/', @URL, 9) - 8) AS [Domain Name],
       REVERSE(SUBSTRING(REVERSE(@URL), CHARINDEX('?', REVERSE(@URL)) + 1,
       CHARINDEX('/', REVERSE(@URL)) - CHARINDEX('?', REVERSE(@URL)) - 1)) AS [Page Name],
       SUBSTRING(@URL, CHARINDEX('?', @URL) + 1, LEN(@URL)) AS [Query Parameter]
Source by www.sql-server-helper.com #
 
PREVIOUS NEXT
Tagged: #Get #Domain #Page #Name #Query #Parameter #URL
ADD COMMENT
Topic
Name
6+9 =