Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

quering server properties from linked servers Expand / Collapse
Author
Message
Posted Monday, August 3, 2009 1:32 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, November 25, 2013 5:29 AM
Points: 28, Visits: 355
I'm trying to query a given servers properties via a linked server connection

select SERVERPROPERTY('edition'), SERVERPROPERTY('ProductVersion') from sql001;
select SERVERPROPERTY('edition'), SERVERPROPERTY('ProductVersion') from sql001.master;

(where sql001 is my linked server definition)

Neither of these statements work, and it may not be possible, but I'd thought I'd ask. I'm on sql 2005. All my other linked server queries work just fine where I use the normal ... type syntax.

thanks in advance,
sean
Post #764340
Posted Tuesday, August 4, 2009 8:13 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 10:01 AM
Points: 10,282, Visits: 13,266
I believe that using the 4 part naming syntax executes the functions on the local server. You should use OPENQUERY().




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #764826
Posted Tuesday, August 4, 2009 8:20 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:47 AM
Points: 12,905, Visits: 32,168
here's an example that Jack was referencing:
exec ServerName.master.dbo.sp_executesql N'Select SERVERPROPERTY(''MachineName'')'

--or if you are calling a function that exists on the server:
SELECT * FROM OPENQUERY(LINKEDSERVER1,'SELECT dbo.T_DATE(''D'')')



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #764833
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse