16.8.8 sql-generation-rules
Apply the following verification sequence when generating SQL. The SQL Reference defines the actual syntax.
Before Generation
- Check the server version and edition.
- Check the target database, owner, table type, and
DESCoutput. - Verify the statement form in the SQL Syntax Dictionary.
- Verify arguments and return types in the Function Dictionary.
- Check edition and table constraints in Support Scope.
Generation Rules
- Do not assume keywords, functions, hints, or transaction behavior from other DBMSs apply.
- Do not replace identifiers with parameter markers.
- For time/distance ranges, DELETE, and UPDATE, provide a query to inspect expected target rows first.
- Specify
ORDER BYwhen result order matters. - Include result checks and cleanup in modification examples.
If an error occurs, use the complete error and schema with the Troubleshooting procedure rather than arbitrarily changing syntax.
Last updated on