Get instance name from Analysis Services such as @@ ServerName
Is there a way to get the current server name from an Analysis Services instance? Basically the same as SELECT @@SERVERNAME
but for SSAS.
I looked SELECT * FROM $system.DISCOVER_INSTANCES
, but it returns an error:
The 'INSTANCE_NAME' constraint is required but not present in the request. Consider using SYSTEMRESTRICTSCHEMA to provide constraints.
SYSTEMRESTRICTSCHEMA
I am getting the same error when trying to use . INSTANCE_NAME
I get the same error when trying to use . When trying to use SYSTEMRESTRICTSCHEMA
and pointing INSTANCE_NAME
, I get the same error.
Any help or understanding is appreciated!
source to share
This will give you the server name:
select [Value] as ServerName from $SYSTEM.DISCOVER_PROPERTIES where [PropertyName] = 'ServerName';
You don't need $ system.DISCOVER_INSTANCES, but the syntax for this is:
select * from SYSTEMRESTRICTSCHEMA($SYSTEM.DISCOVER_INSTANCES, INSTANCE_NAME='MSSQLSERVER');
source to share