Page 1 of 1

Maximum number of fields (columns)

Posted: 15.06.2011, 08:58
by mparak
Hi guys,
I recently got a "Range Check error" when executing a simple "select * from tablename" and discovered that it was related to the number of columns in the resultset. It had nothing to do with the number of rows as I tried a table that had one row only. The minute I reduced the number of columns it worked fine. I am working with more than 255 fields (columns).
Is there any way to tweek the parameters to overcome this limitation.?
By the way I use the TZquery.
Regards
M

Posted: 15.06.2011, 09:20
by jeremicm
are you sure that select is problem? i often get that error on some longint calculations on my app start... sometimes it raises error, sometimes it's fine...

Posted: 15.06.2011, 09:51
by mparak
I have included a procedure that will prove my point.
If you try to open more than 255 fields it gives the error I mentioned.
If column count is below then all is well.


procedure TForm1.Prove_Max_columns_are_restricted;
var mSQL:Tzquery; i:Integer; Number_Columns:String;
begin
try try
Number_Columns=InputBox('Number of fields', 'number of fields', '255');
mSQL:=Tzquery.Create(application);
mSQL.Connection:=ZConnection1;
mSQL.SQL.Text:=' select current_date';
for i:=1 to strToInt(Number_Columns) do
Begin
mSQL.SQL.append(',0 Field_'+IntToStr(i));
End;
mSQL.Open;
ShowMessage(intToStr(mSQL.RecordCount));
finally mSQL.free; end;
except on e:Exception do showMessage(e.message) end;
end;