Other Common SQL Errors
Typically, the name of the column is wrong because of a misspelling. In this case, the correct spelling was 'eventtime', but there was an accidental 's' added to the name.
If the table is not found in the database, it may also be because of a misspelling. Here, the correct table name should be 'alarm_events'.
Any Database Error
The previous error examples have all been from a MySQL database, but the same principles apply to any database. Simply locate the 'caused by', and look at the message afterwards. In this MSSQL syntax error, instead of displaying everything after the syntax error, it only displays the part immediately after. The problem in this query is an extra comma before the word 'FROM'.
Checking the Database Connection
Checking the Database Connection in the Gateway can also be useful to ensure there is a valid connection and there is nothing blocking the execution of queries. The Status page of the Gateway can be used to determine if queries are taking too long, while the Database Connections page can be used to alter the settings of the database to better handle the number of queries running from the Gateway to the database. See the Slow Queries page for more information on changing these settings.
Testing Query Results
Using the Database Query Browser is a good way to test out a query before actually running it on a component. This can help you see what results will be returned so that the query can be modified to narrow down how the query should be formatted.
Checking for Slow Queries
There are several ways that slow running queries can cause improper behavior. See Slow Queries for more details.