End-User Documentation

Query Passes In Dialect Mode but Fails With Schema Loaded

Query Passes In Dialect Mode but Fails With Schema Loaded

This usually means the SQL is structurally valid for the target dialect, but the schema snapshot says the referenced database objects do not match reality.

Common Level 3-Only Issues

  • Missing tables
  • Missing columns
  • Missing procedures
  • Identity or computed-column writes
  • Missing required insert columns

What To Check

  • QueryLens.HasLoadedSchema
  • Whether the snapshot came from the intended database
  • Whether the schema changed since the snapshot was loaded

Example

QueryLens.Dialect = DialectProfile.SqlServer2019;
QueryLens.LoadDbSchemaFrom(connectionString);

var query = new SqlQuery("SELECT missing_column FROM dbo.customers");
Assert.Contains(query.Errors, issue => issue.Code == "QL0011");

Related