Does anyone here know how i can determine the version of SQL running on my linked server through use of TSQL statements?
I am running SQL2005 my linked servers are running a mix of sql2000, 2005 and 2008.
Does anyone here know how i can determine the version of SQL running on my linked server through use of TSQL statements?
I am running SQL2005 my linked servers are running a mix of sql2000, 2005 and 2008.
SELECT @@VERSION
Returns a string detailing the version of the server.
select * from openquery(MyLinkedServer,'SELECT SERVERPROPERTY(''productversion'')')
Works
One minor nitpick about OPENQUERY is that one cannot use anything other than string literals for both the server and the query.
With EXEC AT you can at least use varchar variables for the query (although it can be a pain to quote the stuff correctly) although not for the server-name:
declare @sql AS varchar(max) = 'SELECT SERVERPROPERTY(''productversion'')' EXEC(@sql) AT MyLinkedServer
I assume this is just a parser limitation rather than some deliberate limitation in the design.