While working on a SAP ASE database configured with SAP Replication Server (SRS) as part of a HADR pair, you may want to know how to identify which of the two databases in the HADR pair, you’re working on.
The only sure method I found is to query the @@nodeid global variable.
This nodeid value is different for each of the ASE databases.
Therefore if you’re logged onto the primary node, you will see a different ID.
I found this to be exceptionally useful when logging into a database as sapsso, since this user is redirected to the primary database in a HADR setup.
UPDATE: July 2016, I’ve since found this little gem:
> isql -Usapsa -S<SID> -w999 -X
1> select ASEHOSTNAME()
2> go
——————————-
SERVERHOSTNAME
(1 row affected)