Showing posts with label alias. Show all posts
Showing posts with label alias. Show all posts

Thursday, March 29, 2012

Creating an Alias for a (non-default) SQL Server 2005 Instance

I am trying to create an alias for a particular SQL Server 2005
Instance.
I've tried doing this in the host file but this was unsucessful
because all the host file seems to do is give you an IP address for
the required server (not the acutal SQL instance).
How do I go about setting up the alias correctly, do I need to use DNS
or something like that?
The alias is fixed and of the form "dbsrvMyDatabase"
Any suggestions would be gratefully received.Use cliconfg.exe.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<charlieopenshaw@.gmail.com> wrote in message
news:1178272012.359623.8200@.y80g2000hsf.googlegroups.com...
>I am trying to create an alias for a particular SQL Server 2005
> Instance.
> I've tried doing this in the host file but this was unsucessful
> because all the host file seems to do is give you an IP address for
> the required server (not the acutal SQL instance).
> How do I go about setting up the alias correctly, do I need to use DNS
> or something like that?
> The alias is fixed and of the form "dbsrvMyDatabase"
> Any suggestions would be gratefully received.
>|||Tibor,
Thanks, that worked a treat.
I went to Alias > Add...
Selected TCP/IP, entered the Server Alias, Server name, checked
Dynamically determine port and entered my port number.
I had to get my port number setting from:
SQL Server Configuration Manager > SQL Server 2005 Network
Configuration > TCP/IP > TCP/IP Properties > IP Addresses > TCP
Dynamic Ports
Charlie
On 4 May, 11:40, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Usecliconfg.exe.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://sqlblog.com/blogs/tibor_karaszi
> <charlieopens...@.gmail.com> wrote in message
> news:1178272012.359623.8200@.y80g2000hsf.googlegroups.com...
>
>
>
>
>
>
> - Show quoted text -

Creating an Alias for a (non-default) SQL Server 2005 Instance

I am trying to create an alias for a particular SQL Server 2005
Instance.
I've tried doing this in the host file but this was unsucessful
because all the host file seems to do is give you an IP address for
the required server (not the acutal SQL instance).
How do I go about setting up the alias correctly, do I need to use DNS
or something like that?
The alias is fixed and of the form "dbsrvMyDatabase"
Any suggestions would be gratefully received.
Use cliconfg.exe.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<charlieopenshaw@.gmail.com> wrote in message
news:1178272012.359623.8200@.y80g2000hsf.googlegrou ps.com...
>I am trying to create an alias for a particular SQL Server 2005
> Instance.
> I've tried doing this in the host file but this was unsucessful
> because all the host file seems to do is give you an IP address for
> the required server (not the acutal SQL instance).
> How do I go about setting up the alias correctly, do I need to use DNS
> or something like that?
> The alias is fixed and of the form "dbsrvMyDatabase"
> Any suggestions would be gratefully received.
>
|||Tibor,
Thanks, that worked a treat.
I went to Alias > Add...
Selected TCP/IP, entered the Server Alias, Server name, checked
Dynamically determine port and entered my port number.
I had to get my port number setting from:
SQL Server Configuration Manager > SQL Server 2005 Network
Configuration > TCP/IP > TCP/IP Properties > IP Addresses > TCP
Dynamic Ports
Charlie
On 4 May, 11:40, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Usecliconfg.exe.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <charlieopens...@.gmail.com> wrote in message
> news:1178272012.359623.8200@.y80g2000hsf.googlegrou ps.com...
>
>
>
>
> - Show quoted text -
sql

Creating an Alias for a (non-default) SQL Server 2005 Instance

I am trying to create an alias for a particular SQL Server 2005
Instance.
I've tried doing this in the host file but this was unsucessful
because all the host file seems to do is give you an IP address for
the required server (not the acutal SQL instance).
How do I go about setting up the alias correctly, do I need to use DNS
or something like that?
The alias is fixed and of the form "dbsrvMyDatabase"
Any suggestions would be gratefully received.Use cliconfg.exe.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<charlieopenshaw@.gmail.com> wrote in message
news:1178272012.359623.8200@.y80g2000hsf.googlegroups.com...
>I am trying to create an alias for a particular SQL Server 2005
> Instance.
> I've tried doing this in the host file but this was unsucessful
> because all the host file seems to do is give you an IP address for
> the required server (not the acutal SQL instance).
> How do I go about setting up the alias correctly, do I need to use DNS
> or something like that?
> The alias is fixed and of the form "dbsrvMyDatabase"
> Any suggestions would be gratefully received.
>|||Tibor,
Thanks, that worked a treat.
I went to Alias > Add...
Selected TCP/IP, entered the Server Alias, Server name, checked
Dynamically determine port and entered my port number.
I had to get my port number setting from:
SQL Server Configuration Manager > SQL Server 2005 Network
Configuration > TCP/IP > TCP/IP Properties > IP Addresses > TCP
Dynamic Ports
Charlie
On 4 May, 11:40, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Usecliconfg.exe.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <charlieopens...@.gmail.com> wrote in message
> news:1178272012.359623.8200@.y80g2000hsf.googlegroups.com...
>
> >I am trying to create analiasfor a particular SQL Server 2005
> >Instance.
> > I've tried doing this in the host file but this was unsucessful
> > because all the host file seems to do is give you an IP address for
> > the required server (not the acutal SQLinstance).
> > How do I go about setting up thealiascorrectly, do I need to use DNS
> > or something like that?
> > Thealiasis fixed and of the form "dbsrvMyDatabase"
> > Any suggestions would be gratefully received.- Hide quoted text -
> - Show quoted text -

Creating an alias

I have an alias that can get very long because it maintains a information of
where it came from. Is there a way to alias an alias?
My first thought was:
Declare @.T1 varchar(128)
Set T1 = 'MyAlias'
...
Inner Join Table1 as @.T1
This of course does not work. Is there way?
On Tue, 15 Feb 2005 07:25:06 -0800, Bruce Parker wrote:

>I have an alias that can get very long because it maintains a information of
>where it came from. Is there a way to alias an alias?
>My first thought was:
>Declare @.T1 varchar(128)
>Set T1 = 'MyAlias'
>...
>Inner Join Table1 as @.T1
>This of course does not work. Is there way?
Hi Bruce,
Not without using dynamic SQL.
But I fail to see why you would want this. A table alias is never visible
to the outside user, it's only used as part of your query.
If you choose an alias that has some added value, like indicating where
something came from, then that's good - it can make your queries eaasier
to maintain.
If such an alias gets long, then so be it. Either you keep it, paying the
price of a long alias for the gain of a self-documenting query - or you
shorten the alias, paying the price of a less self-documenting query for
the gain of a shorter alias.
But I don't see how using a variable to store the alias would gain you any
benefit. I don't see how query #1 below would be easier to understand that
query #2.
Query #1 (syntactically not correct!!)
DECLARE @.T1 varchar(128)
SET @.T1 = 'MyAlias'
SELECT @.T1.Column1, @.T2.Column2
FROM Table1 AS @.T1
WHERE @.T1.Column3 > @.T1.Column4
Query #2
SELECT T1.Column1, T2.Column2
FROM Table1 AS T1-- MyAlias
WHERE T1.Column3 > T1.Column4
Query #3
SELECT MyAlias.Column1, MyAlias.Column2
FROM Table1 AS MyAlias
WHERE MyAlias.Column3 > MyAlias.Column4
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)