November 1, 2012 at 1:21 am
Running the below sql on server1 where I have defined linked servers to other servers.
SELECT name as DBName,[crdate] AS [LastStartupDate]
FROM[Server2].[master].[dbo].[sysdatabases]
where name='tempdb'
SELECT name as DBName,[crdate] AS [LastStartupDate]
FROM[Server3].[master].[dbo].[sysdatabases]
where name='tempdb'
How can I get the Server2 and server 3 names listed in the above select statement?
I need the names of the servers under a separate column.
result :
Server name DBname LastStartupdate
tempdb 10-10-2000
tempdb 11-11-2011
Thanks
November 1, 2012 at 1:32 am
use union
SELECT name as DBName,[crdate] AS [LastStartupDate]
FROM [Server2].[master].[dbo].[sysdatabases]
where name='tempdb'
union
SELECT name as DBName,[crdate] AS [LastStartupDate]
FROM [Server3].[master].[dbo].[sysdatabases]
where name='tempdb'
-----------------------------------------------------------------------------
संकेत कोकणे
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply