Skip to main content
2 of 2
added TAGS and formatted text
Marcello Miorelli
  • 16.6k
  • 53
  • 170
  • 311

Get @@SERVERNAME from linked server

This seems like a basic question but I can't find any answers out there - I need to be able to get the server name/instance etc. from a linked server. I've tried a couple of things:

select <linked server>.@@SERVERNAME;
select <linked server>.SERVERPROPERTY('ServerName');

... but no joy. Any ideas?

This is SQL 2008 R2 & 2014 (2008R2 is the linked server)

EDIT: Errors are:

Msg 102, Level 15, State 1, Line 2 Incorrect syntax near '@@SERVERNAME'.

dwjv
  • 669
  • 2
  • 9
  • 15