Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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 @ 8:45 AM
Points: 10,711, Visits: 14,456
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
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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: Yesterday @ 2:09 PM
Points: 13,975, Visits: 36,293
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #764833
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse