Connecting Tech Pros Worldwide Help | Site Map

find server name using query

  #1  
Old June 6th, 2007, 09:30 AM
Newbie
 
Join Date: Jun 2007
Posts: 1
how we find the server name using sqlserver2005-Query analyser
  #2  
Old June 6th, 2007, 12:42 PM
Member
 
Join Date: May 2007
Location: Chennai
Posts: 99

re: find server name using query


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

re: find server name using query


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.
  #4  
Old June 18th, 2007, 08:36 AM
Newbie
 
Join Date: Jun 2007
Posts: 1

re: find server name using query


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Download the JAVA , .NET and SQL Server interview with answers Jobs answers 2 September 26th, 2006 02:25 PM
Download the JAVA , .NET and SQL Server interview PDF Jobs answers 0 September 17th, 2006 02:05 PM
SQL Server 2000 & MS SP2 William F. O'Neill answers 5 July 20th, 2005 05:43 AM
email server name? Alistair answers 1 July 19th, 2005 11:27 AM