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
Jack Corbett
SSC Guru
Points: 184394
I believe that using the 4 part naming syntax executes the functions on the local server. You should use OPENQUERY().
Lowell
SSC Guru
Points: 323518
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!