ihMessages Table
The ihMessages table contains Historian messages such as alerts, informational topics, and connection information contained in the audit log. Each row in this table represents a message. The following table describes the columns of the ihMessages table.
Column Name | Data Type | Description |
---|---|---|
TimeStamp | VT_DBTimeStamp | The date and time that the message was created. |
TimeStampSeconds | VT_DBTimeStamp | The date and time that the message was created. |
Microseconds | VT_I4 | The microsecond portion of the date and time for the message. |
Topic | VT_BSTR | The topic name of the message:
|
Username | VT_BSTR | Name of the Windows user who generated the message, or who the message is associated with. |
MessageNumber | VT_I4 | Message number for the message. A message number is a unique identifier associated with the message template. |
MessageString | VT_BSTR | Translated text of the message, including any substitutions. Messages generally include translated fixed text and variable substitutions such as timestamps, usernames, and tagnames. |
TimeZone | VT_BSTR | The type of time zone used:
|
DaylightSavingTime | VT_BOOL | Indicates whether Daylight Saving Time logic should be applied to timestamps. |
Row Count | VT_I4 | Indicates the maximum number of rows that can be returned. A value of 0 indicates there is no limit to the number of rows returned. |
ihMessages Examples
One task that you might want to perform on the ihMessages table is retrieving a history of alerts and messages, with timestamps and user information. For instance, you might want to query the alerts for a day, or all messages associated with a particular username.
Sample SQL statements for the ihMessages table are outlined in the following examples.Example 1: Retrieve All Messages and Alerts for Today
SELECT * FROM ihmessages WHERE timestamp>=today
Example 2: Retrieve All Alert Messages for a Specific User and Time
SELECT * FROM ihmessages
WHERE timestamp>'12-sep-2001 02:00:00'
AND topic=AlertTopics
AND username='DataArchiver' ORDER BY timestamp
Example 3: Retrieve All Messages in Your Archive
SELECT * FROM ihMessages WHERE timestamp <= Now
Example 4: Retrieve All Messages for a Specific User
SELECT * FROM ihMessages WHERE username=operator1
AND timestamp<=Now
Example 5: Count All Messages by a Specific User
SELECT username, COUNT(*) FROM ihMessages
WHERE timestamp <=Now GROUP BY username