Wednesday, March 28, 2012

how to get the server name ?

Hi,
will the SERVERPROPERTY('machine name') property
give you the name of the SERVER on the local machine?
So that I can feed it into a connection statement such as
Data Source="...name..."? Because I tried using
Data Source=(local) and it doesn't seem to work -- any
reason why?
Thanks!
Christy Warner.
"Chris V." wrote:

> SERVEProperty is exactly what I was needed 1
> Thanks for your help.
> Chris
> "Chris V." <tophe_news@.hotmail.com> wrote in message
> news:emzzoXu$EHA.2180@.TK2MSFTNGP12.phx.gbl...
>
>ChristyWarner wrote:
> Hi,
> will the SERVERPROPERTY('machine name') property
> give you the name of the SERVER on the local machine?
> So that I can feed it into a connection statement such as
> Data Source="...name..."? Because I tried using
> Data Source=(local) and it doesn't seem to work -- any
> reason why?
> Thanks!
> Christy Warner.
>
If you're already connected, then I don't understand why you need the
server name. OTOH, if you're not connected, then you can't use the
SERVERPROPERTY function because you need to be connected...
If SQL Server is installed locally and is the default instance, you can
use "(local)" as the server name, use "." as the server name, use the IP
Address as the server name, or use the name of the PC on which SQL
Server is installed as the server name.
Where is this SQL Server? If local, what is the name of your PC? If
remote, someone at the company should be able to tell you what the SQL
Server name is.
David Gugick
Imceda Software
www.imceda.com|||did you try 'localhost'
VikasKumar
---
VikasKumar's Profile: http://www.msmcse.ms/member.php?userid=769
View this thread: http://www.msmcse.ms/t-1870132190

No comments:

Post a Comment