Get Domain Name From Url In Sql Server. I am looking some solution that brings my full user name from AD in SQL Server. -- SQL Query to Extract Domain name From Email and Count Number of Records USE SQLTEST GO SELECT SUBSTRING Email Adress CHARINDEX Email Adress 1 LENEmail Adress AS Domain Name COUNT AS Total Records with this Domain FROM EmailAdress WHERE LENEmail Adress 1 GROUP BY SUBSTRING Email Adress CHARINDEX Email Adress 1 LENEmail Adress.
SELECT loginame FROM syssysprocesses WHERE spid SPID. SELECT SUSER_SNAME SELECT ORIGINAL_LOGIN SELECT SYSTEM_USER. XML column queries includes an example of how to extract the code and description pairs from a coded value domain as a result set.
After getting tired of issuing ad-hoc queries that included WHERE clauses like where referer like google I created a SQL Server user-defined function UDF to extract the domain from the referring URL.
SELECT REPLACESUSER_NAME HOST_NAME as userId. Resolving domain codes to description values using SQL. XML column queries includes an example of how to extract the code and description pairs from a coded value domain as a result set. Here is the source codes of SQL function used to parse domain name from given URL address string parameter.