Advantage database how to retieve connection name

742 views Asked by At

I am using Sybase Advantage, I have 2 tables:

  • The first table has the data records
  • The second table stores a history of the first

The first table has triggers to populate records in the second table depending on which fields get changed.

I would like to store the connection name (PC which made the request), the name that is displayed in the active queries page (Server Info dialog) and not the username. Does anyone know if this is possible?

Thanks

1

There are 1 answers

5
LanceSc On

The following SQL statement can be used to retrieve the computer name instead of the user name.

SELECT * FROM ( EXECUTE PROCEDURE sp_mgGetConnectedUsers() ) ConnUsers WHERE ConnUsers.DictionaryUser = USER();

The stored procedure sp_mgGetConnectedUsers is documented here.