Solved

Seeing error message, "At least *ColumnName* should be specified in this SQL statement" when trying to query some tables

  • 21 March 2023
  • 1 reply
  • 37 views

Userlevel 1
Badge

When I try to query certain tables, I see an error message that indicates I must specify a column value in my SQL statement. For example, when trying to use the following query to retrieve the Reports table with the Act-On ODBC Driver:

SELECT * FROM Reports

I see the following error:

At least MESSAGEID should be specified in this SQL statement.

How can I fix this?

icon

Best answer by DylanO 21 March 2023, 16:33

View original

1 reply

Userlevel 1
Badge

As the error message indicates, certain tables do require you to specify a value for a column in your query. To fix the error for the Act-On Reports table example, all you need to do is specify a value from the MessageID column in your query using a WHERE clause, like this:

SELECT * FROM Reports WHERE MessageID = '<ExampleMessageID>'

This will retrieve all of the Reports records with that specified MessageID. Some columns, such as MessageID, also support the 'IN' operator, which allows you to specify multiple values in your WHERE clause:

SELECT * FROM Reports WHERE MessageID IN ('<MessageID1>','<MessageID2>')

You can see what operators are supported for a given column of a table on that table's page in the Data Model section of the driver's documentation. You can also find which tables require a WHERE clause to specify a given column value by looking through the Data Model section of any of our connectors.

Reply