How to get DOMAIN name from SQL Server?

domain-name, sql-server-2005, ssms-2005

Solution

In T-SQL, you would use this to query the Domain Name of the SQL Server:

SELECT DEFAULT_DOMAIN()[DomainName]

Problem

I tried using `EXEC sp_who2;` to find the server's domain name, but it gives host, users, etc. I need to know my SQL Server's domain name, so I can install a plugin to the SQL Server Management Studio.

Original source