Re: How to make a select to another database using sp_addlinkedserver?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

In Link server you could also use OPEN QUERY to query the databases

Open Query

Select * from openquery('<Linked Server>','select * from
DBNAME.Table_owner.Table_Name')


Thanks
Hari
SQL Server MVP

"Marcelo Moreira" <marcelo.moreira@xxxxxxxxxxxxxxx> wrote in message
news:e6LaETghFHA.2484@xxxxxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> I trying to use sp_addlinkedserver, after I added successfully a new
> linked server I do not know how to use the server...
>
> I did this to add the server:
>
> exec sp_addlinkedserver
> 'Server2','sqloledb','Northwind','myComputer','','','Region'
>
> Now, I want to do a simple SELECT statement to the Region table of
> Northwind, how do I do this?
>
> Obviously, I am in another database...like for example "pubs"
>
> Thanks for help,
>
> Marcelo Moreira
>


.



Relevant Pages

  • Re: moving sql data
    ... thanks hari for answer. ... > After setting up the database you can change the server name using the ... > SQL Server MVP ... >> does somebody know if i can transfer system databases ...
    (microsoft.public.sqlserver.setup)
  • Re: Who should be owner if bd?
    ... Hari, perhaps you meant sp_changedbowner? ... SQL Server MVP ... >> Admin account). ...
    (microsoft.public.sqlserver.security)
  • Re: What needs to be set up to use the xp_sendmail Stored Procedure?
    ... Hari ... SQL Server MVP ... > Our Server has SQL Server 2000 SP3 on it, The server is a Windows Small ...
    (microsoft.public.sqlserver.setup)
  • Re: SQL7 to SQL2000 and hardware upgrade
    ... SQL Server MVP ... >I have a new box with W2003 Server to replace our existing W2000 ... Prev by Date: ...
    (microsoft.public.sqlserver.setup)
  • Re: Xvnc server.
    ... On Tuesday 05 August 2003 08:23 am, Grinberg, Hari wrote: ... You don't need X on the server to have XVnc server to run. ...
    (RedHat)