Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Database view giving error: Syntax Error or Access Rule Violation detected by database ((conn=395195) Unknown column 'cod.a_str_22' in 'on clause')

TT3
Kilo Guru

I am trying to create a database view. After specifying all the details, when I click on Try It link, I am getting below error.

Syntax Error or Access Rule Violation detected by database ((conn=395195) Unknown column 'cod.a_str_22' in 'on clause')

I have checked:

  • There is no column named a_str_22 in the table which aliases cod.
  • None of the where clause refers to a_str_22 column for table which aliases cod.
  • The table which aliases cod, does not have any access restriction. I was able to create another view in the same scope.

Am I missing anything?

Note: Relevant answers/comment will be marked appropriately.

1 ACCEPTED SOLUTION

TT3
Kilo Guru

The fix was to update "order" column. So the table that is primary and have no dependency then it should be 100 and subsequent can be 200 and so on.

Thank you.

View solution in original post

11 REPLIES 11

Hitoshi Ozawa
Giga Sage
Giga Sage

Seems like a bug. Should contact Now Support to report it in.

From the message, it seems to be MySQL error on table join. It may be joining to incorporate ACL.

TT3
Kilo Guru

Just an update, if I remove sys_user table from the view then it is working.

Not sure why having sys_user throws error for another table (cod).

Miguel Donayre
ServiceNow Employee
ServiceNow Employee

In that sys_user where clause was that a reference field? 

That type of error comes up on reference fields

Even that is also a text field. Just FYI: if I remove sys_user table than the view works fine. However, when we add it the error is shown - which refers to cod table  and that has no relation with sys_user table.

Does it mean we have to tie all of them?