You are here: Re: Logging Into Linked Server « MsSQL Server « IT news, forums, messages
Re: Logging Into Linked Server

Posted by Erland Sommarskog on 05/15/06 22:16

Neil (nospam@nospam.net) writes:
> Speaking of linking to a server, is it possible to assign a linked
> server an alias at the time it is linked? The reason is that our linked
> server is a web server, and it's possible that sometime in the
> not-too-distant future its address will change, and, at that point, I'd
> have to go into the stored procedures and manually change the server
> name. Can I assign an alias so that if a new server has to be linked it
> can have the same alias?

If you are on SQL 2005, you can always use synonyms.

If you are on some earlier version of SQL Server you can use
sp_addlinkedserver. You see, what you define with sp_addlinkedserver is
really an alias.

In its simplest form, you just say:

sp_addlinksedserver 'THATSERVER'

and THATSERVER will refer to a server with that name. However, you
can also say:

sp_addlinkedserver 'MYSERVERNAME', '', 'SQLOLEDB', 'THATSERVER'

so that you can use MYSERVERNAME as a reference to THATSERVER. Thus,
when you web server changes, you just drop the server, and recreate
it with the new information.

Note: the syntax above may not work exactly like that. I usually have
problem with more advanced usage of sp_addlinksedserver myself. But
it usually sorts out when I've been looking at the topic for
sp_addlinksedserver in Books Online for a while.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация