>hi sergey,
>
>the code is
The size of command in Fox shouldn't be a problem - I am presently running one that's about 15K (and that's before I merge some more into it), so it should be over 16 at runtime.
Maybe you're hitting the limit of 8K per single statement, SQL side?
You may try to split your selects into separate ones, selecting into a single #temp table - the first one to select ... into #temp from..., and then the others to insert into #temp select ... from... etc. Finally,
select * from #temp
drop table #temp
That shouldn't take too long to try.