dbQueryBuilder failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘viewed’ cannot be null
If you read the error it tells you what the problem is. Otherwise, not enough information provided. Post the code.
Column 'viewed' cannot be null
XD