I get the following error

FATAL: emalloc(): Unable to allocate 1073741824 bytes

when I try to read a record from an MS SQL
database with more than 21 fields in the record. I've tried to release memory, and read the rest of the fields with a second query. I'm using the following code to read the data.
odbc_free_result($result);
odbc_close_all;
$query2="SELECT DOMAINNAME, AnnualSales, Employees, Notes, Webad, Specials, CustomerID, WebLinkStorage
FROM Customers WHERE CustomerID = $company_id";

$conn=odbc_connect($hostname,$userid,$passwd);
if (!$conn) {
echo "Database Connection Error!<BR>If this problem persists please contact the Webmaster.";
exit;
}

$result=odbc_exec($conn, $query2);