November 9, 2010 at 5:51 am
Hi all.
Is it possible to list all the objects of another server by calling it in a separate server? In my case, I have 2 servers (say Server A and Server B). I want to get all objects of Server B by calling it in Server A. It should be like SELECT * FROM ServerB.sysobjects. Thanks!
MS SQL Version: 2000
November 9, 2010 at 5:58 am
reggae_blur (11/9/2010)
Hi all.Is it possible to list all the objects of another server by calling it in a separate server? In my case, I have 2 servers (say Server A and Server B). I want to get all objects of Server B by calling it in Server A. It should be like SELECT * FROM ServerB.sysobjects. Thanks!
MS SQL Version: 2000
Create a linked server use the fully qualified name.
Muthukkumaran Kaliyamoorthy
https://www.sqlserverblogforum.com/
November 9, 2010 at 5:58 am
Yes it is very much possible if you can create linked server.
November 9, 2010 at 5:59 am
The first thing to do is to set up a linked server object on one server, pointing at the other. The next thing to do is loop through all the databases on the second server, and select from sysobjects on each one.
If you could provide a bit more detail on what you want to do and why, we could probably help you with a better solution.
John
November 9, 2010 at 6:03 am
thanks for the immediate response! 🙂
actually we're not allowed to create a linked server. 🙁 but i can execute a query successfully in Server A. This query runs successfully when being ran in Server A: SELECT * FROM ServerB.dbo.Table1
November 9, 2010 at 6:29 am
Hi
If you are not allowed to have link server then why do you want to query in serverB
You have to create link server between Server A and ServerB inorder to query
Try with Syntax for Linked server
sp_addlinkedserver [ @server= ] 'server' [ , [ @srvproduct= ] 'product_name' ]
[ , [ @provider= ] 'provider_name' ]
[ , [ @datasrc= ] 'data_source' ]
[ , [ @location= ] 'location' ]
[ , [ @provstr= ] 'provider_string' ]
[ , [ @catalog= ] 'catalog' ]
On scuessful you can use
SELECT * FROM ServerB.sysobjects
Thanks
Parthi
Thanks
Parthi
November 9, 2010 at 6:32 am
Hi parthi,
Upon checking, we already have a linked server for Server B, that's why I can query successfully from Server B. My apologies.
So, my question now is, how can I get all the databases of Server B by executing it in Server A? Thanks!
November 9, 2010 at 6:37 am
reggae_blur (11/9/2010)
Hi parthi,Upon checking, we already have a linked server for Server B, that's why I can query successfully from Server B. My apologies.
So, my question now is, how can I get all the databases of Server B by executing it in Server A? Thanks!
Try to write a script ?
Use some logic(use a loop & openquery...)
There is number of ways to get this.
Muthukkumaran Kaliyamoorthy
https://www.sqlserverblogforum.com/
November 9, 2010 at 6:39 am
reggae_blur (11/9/2010)
So, my question now is, how can I get all the databases of Server B by executing it in Server A? Thanks!
You can't, unless you create a linked server object on Server A.
Another thing you might consider is using an Integration Services package.
John
November 9, 2010 at 6:48 am
Parthi,
Running the query below in Server A gives me an "Invalid Object Name" error...:-)
SELECT * FROM ServerB.sysobjects
November 9, 2010 at 6:50 am
I already have a linked server. I just don't know how the list of Server B's databases. 🙂
Executing sp_databases in Server A returns only the databases of Server A.
November 9, 2010 at 7:03 am
reggae_blur (11/9/2010)
Parthi,Running the query below in Server A gives me an "Invalid Object Name" error...:-)
SELECT * FROM ServerB.sysobjects
Try this
SELECT * FROM [ServerB].Tempdb.dbo.sysobjects
Thanks
Parthi
Thanks
Parthi
November 9, 2010 at 7:06 am
reggae_blur (11/9/2010)
Parthi,Running the query below in Server A gives me an "Invalid Object Name" error...:-)
SELECT * FROM ServerB.sysobjects
Did you read my prrvious replay
FQN-- select * from [LSname].[dbname].[schema].[object]
Muthukkumaran Kaliyamoorthy
https://www.sqlserverblogforum.com/
November 9, 2010 at 7:10 am
thanks muthukkumaran..
i tried this SELECT * FROM ServerB.master.dbo.sysdatabases
it worked! 🙂
November 9, 2010 at 7:14 am
reggae_blur (11/9/2010)
thanks muthukkumaran..i tried this SELECT * FROM ServerB.master.dbo.sysdatabases
it worked! 🙂
Ur Welcome
Muthukkumaran Kaliyamoorthy
https://www.sqlserverblogforum.com/
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply