this is defiantly a case where you MUST test for SQLCODE. Intersystems states that the values of the fields (in this case ID) cannot be relied upon UNLESS you test SQLCODE after the sql code has been run,
I have argued this with support and they say "read the doc's, we can do what we want with the variables, its up to you to test SQLCODE before you rely upon the returned data" I also go and play in the SQL manager and put in the exact same code (replacing values with literals) - SQL manager then shows you what the real error is. kev
