Thursday, May 18

Could not allocate ancillary table for view or function resolution

I received the error message "Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (256) was exceeded."

This was because I had created a chain of views, many of which used the "union" SQL statement.

e.g. view 1, 3 queries joined with the union statement
view 2, 2 queries
view 3, 5 queries
view 4, 4 queries
view 5, 3 queries

3 * 2 * 5 * 4 * 3 is greater than 256, and caused this error. Rewriting some of the views to use CASE statements in the select statement, rather than the union statement rectified the problem.

No comments: