Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 connection to another server

Author  Topic 

rohans
Posting Yak Master

194 Posts

Posted - 2004-12-15 : 08:47:47
Hello,
I am wrinting a script that need to connect to another database and pull some info from the sysobjects table in that database. How do I connect to that other database from within my script.
I tried using the "EXEC CONNECT TO" as stated in the help.

All help appreciated.

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-12-15 : 22:07:32
select field1,field2,... from
[databasename].[owner].[objectname]

--------------------
keeping it simple...
Go to Top of Page

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2004-12-15 : 22:21:36
Lookup sp_addlinkedserver
Then you can query just like any other by adding [linkedservername].[db].[dbo].[table] to the from clause.

Go to Top of Page

rohans
Posting Yak Master

194 Posts

Posted - 2004-12-16 : 14:46:56
Thanks, I have used linked server before so it is not a problem to setup. I was really wishing that I could connect using a command, similar to what is available in Oracle. If any one knows how to do this please let me know.

All help appreciated.
Go to Top of Page
   

- Advertisement -