Check generated sql script for query