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.

Table 1. ihMessages Table
Column NameData TypeDescription
TimeStampVT_DBTimeStampThe date and time that the message was created.
TimeStampSecondsVT_DBTimeStampThe date and time that the message was created.
MicrosecondsVT_I4The microsecond portion of the date and time for the message.
TopicVT_BSTRThe topic name of the message:
  • AlertTopics
  • AllTopics
  • ConfigurationAudit
  • Connections
  • General
  • MessageTopicMax
  • MessageTopics
  • Performance
  • ServiceControl
  • Security
  • Undefined
UsernameVT_BSTRName of the Windows user who generated the message, or who the message is associated with.
MessageNumberVT_I4Message number for the message. A message number is a unique identifier associated with the message template.
MessageStringVT_BSTRTranslated text of the message, including any substitutions. Messages generally include translated fixed text and variable substitutions such as timestamps, usernames, and tagnames.
TimeZoneVT_BSTRThe type of time zone used:
  • Client
  • Server
  • Explicit bias number (number of minutes from GMT)
DaylightSavingTimeVT_BOOLIndicates whether Daylight Saving Time logic should be applied to timestamps.
Row CountVT_I4Indicates 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