TSQLQuery was not designed to run multiple SQL queries at once, let alone a combination of select (which requires .Open) and non-select (requires .ExecSQL). If you need to run insert followed by select whose returned rows are required, there's no other way but to run each query on its own (insert + .ExecSQL followed by select + .Open).