Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get DOMAIN name from SQL Server?

Tags:

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.

like image 737
Fandango68 Avatar asked Feb 06 '14 00:02

Fandango68


People also ask

How do I select a domain name in SQL?

select right(email_address, length(email_address)-INSTR(email_address, '@')) ... so you don't have to guess how many sub-domains your user's email domain has. Show activity on this post. Brillant answer!

What is domain name in SQL?

A domain is essentially a data type with optional constraints (restrictions on the allowed set of values). The user who defines a domain becomes its owner. Domains are useful for abstracting common constraints on fields into a single location for maintenance.


1 Answers

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

SELECT DEFAULT_DOMAIN()[DomainName] 
like image 85
MikeTeeVee Avatar answered Oct 21 '22 11:10

MikeTeeVee