Run SERVERPROPERTY() Against a Linked Server in SQL Server

If you need to run the SERVERPROPERTY() function against a linked server in SQL Server, you can use a pass-through query. To do this, pass the SERVERPROPERTY() function as the second argument to the OPENQUERY() function (the first argument is the linked server name).

Example 1 – Basic Example

Here’s an example.

SELECT * FROM OPENQUERY(
    Homer,
    'SELECT SERVERPROPERTY(''ProductLevel'') AS [Remote ProductLevel];'
);

Result:

+-----------------------+
| Remote ProductLevel   |
|-----------------------|
| RTM                   |
+-----------------------+

Example 2 – Compared with a Local Query

Just to confirm that this was in fact coming from the linked server (and not the local server), here it is again, along with a query against the local server.

SELECT SERVERPROPERTY('ProductLevel') AS [Local ProductLevel];

SELECT * FROM OPENQUERY(
    Homer,
    'SELECT SERVERPROPERTY(''ProductLevel'') AS [Remote ProductLevel];'
);

Result:

+----------------------+
| Local ProductLevel   |
|----------------------|
| CTP3.2               |
+----------------------+
(1 row affected)
+-----------------------+
| Remote ProductLevel   |
|-----------------------|
| RTM                   |
+-----------------------+
(1 row affected)

In this case, the local server is running SQL Server 2019 Preview, and the linked server is running SQL Server 2017. RTM means it’s an original release version, whereas, CTPn means it’s a Community Technology Preview version.

See Quick Script that Returns All Properties from SERVERPROPERTY() in SQL Server 2017/2019 if you need a script that returns all properties.

Also see the Microsoft documentation for a full list of arguments accepted by this function.