[Note: Some of the material in this article, and in today's demo file ExecuteSQL Sandbox, previously appeared in my March 2011 article, Custom Functions for Internal SQL.]
The other day a colleague remarked, “You know, it’s going to be interesting to see if you SQL guys are still so excited about ExecuteSQL when something gets renamed and your code breaks.” He had a good point: code is “brittle” if it works initially, but then subsequently breaks as a result of a seemingly innocuous action.
Here are some things that can cause ExecuteSQL code to break:
- Renaming a table occurrence (TO)
- Renaming a field
- Using a “reserved word” as a field or TO name
- Having a problematic character in a field or TO name
- Executing the code in a foreign country (!)
- Changing a field’s type (e.g., from text to number or vice versa)
…and today we’re going to look at some defensive measures we can employ to prevent problems when these things occur.
Using the “orders” table in the demo file…












Recent Comments