SQLTeam.com | Weblogs | Forums

Number of records returned in aggregation

Sounds like its doing some parsing of the SQL for some purpose ... and winding up just "getting in the way".

In similar situations I have tended to move all the code to a Stored Procedure and just execute the SProc from remote (i.e. VBA SQL in your case) to stop it "trying to be helpful". Often helps with debugging too as you can just run the EXEC MySproc @PARAM1='FOO', @PARAM2='BAR' in isolation to test

Thanks again. I'll have that in mind.