Recently I was asked by a customer with this question. In MS SQL Server, there is a function called host_name() that will return the work station name.
Here is how I would do it in Caché :
With default SQL schema name, in my case SQLUser in SQL (which is equivalent as User in Caché class definition), I have a class called User.dummy, I added a classmethod called hostname and expose it as SQL function host_name:
Class User.Dummy Extends %Persistent [ ClassType = persistent, DdlAllowed, ProcedureBlock, SqlRowIdPrivate, SqlTableName = dummy, StorageStrategy = "" ]
Property f1 As %Library.Integer(MAXVAL = 2147483647, MINVAL = -2147483648) [ SqlColumnNumber = 2 ];
ClassMethod hostname() As %Library.String [ SqlName = host_name, SqlProc ]
I have already populated one row in my SQLUser.dummy table.
From SQL client, I can do this SQL statement:
select host_name() from dummy