Connections

Problem: Finding the Server Name

How do I find the server name of the system I am connected to?

Solution: Query the systables Table

Run the following query against the system tables:

SELECT DBSERVERNAME from systables where tabid = 1;

This also demonstrates a method for doing a SELECT for other SQL constants when they are not in a particular table. You can do this by selecting such items as CURRENT or USER in the same manner. The "WHERE tabid = 1" is simply a way of ensuring that you get only one row returned. Another method of doing this is to create a dummy table called "dummy" with only one row and only one column in the table. Then you could

SELECT CURRENT from dummy;

and get the same type of result.

Problem: How many Users ...

Get Informix DBA Survival Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.