quering server properties from linked servers

  • 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

  • I believe that using the 4 part naming syntax executes the functions on the local server. You should use OPENQUERY().

  • 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!

  • Viewing 3 posts - 1 through 2 (of 2 total)

    You must be logged in to reply to this topic. Login to reply