Connecting Tech Pros Worldwide Help | Site Map

find server name using query

 
LinkBack Thread Tools Search this Thread
  #1  
Old June 6th, 2007, 08:30 AM
Newbie
 
Join Date: Jun 2007
Posts: 1
Default find server name using query

how we find the server name using sqlserver2005-Query analyser
Reply
  #2  
Old June 6th, 2007, 11:42 AM
Member
 
Join Date: May 2007
Location: Chennai
Posts: 99
Default

Use the following query
select @@servername
Reply
  #3  
Old June 8th, 2007, 07:53 PM
Member
 
Join Date: Jun 2007
Posts: 44
Default

Quote:
Originally Posted by Vidhura
Use the following query
select @@servername
@@ServerName returns the servername of the sql server and

Expand|Select|Wrap|Line Numbers
  1.  select serverproperty('MachineName') 
  2.  
gives the box name in which sql server is running.
Reply
  #4  
Old June 18th, 2007, 07:36 AM
Newbie
 
Join Date: Jun 2007
Posts: 1
Default Check it out ?!

to find machine name by sql qury : select host_name();
to find machine name and ip addrss by c# :
string hostName = Dns.GetHostName();
listBox1.Items.Add ("Host Name = " + hostName);
//v can also use this
//IPHostEntry local =Dns.GetHostByName(hostName);
IPHostEntry local = Dns.GetHostEntry(hostName);
foreach (IPAddress ipaddress in local.AddressList)
{
listBox1.Items.Add ("IPAddress = " + ipaddress.ToString());
}
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.