I need to get data from a remote SQL 2000 server and store it in a new MySQL server. I am using the FreeTSD module for php 5.3 to connect to the SQL 2000 server. I can connect without problems.
Here's my issue; one particular table isn't yielding any result to this query:
SELECT * FROM Item
But this query is successful when I test it SQL Query Analyzer.
I do get results (also remote) when I change it to:
SELECT * FROM Brands
The Item table holds over 500K records and I'm thinking that that might have something to do with it. Could that be the issue and how can I work around that. I have tried this without result:
SELECT TOP 10 * FROM Item
This is the php code to connect:
try {
$db = new PDO('odbc:Driver=FreeTDS; Server=xxx.xxx.xxx.xxx; Port=1433; Database=xxxxx; UID=xxxxx; PWD=xxxxxx;');
} catch(PDOException $exception) {
die("Unable to open database.<br>Error message:<br><br>$exception.");
}
And this is the select code:
$query = "SELECT * FROM Item";
$statement = $db->prepare($query);
$statement->execute();
$data = $statement->fetchAll(PDO::FETCH_ASSOC);
echo '<pre>';
var_dump($data);
echo '</pre>';
Which returns an empty array.
SELECT c = COUNT(*) FROM Item
? How about just a single column instead of all? – Aaron Bertrand♦ Jun 6 '13 at 18:39array(1) { [0]=> array(1) { ["c"]=> string(6) "180783" } }
– Abel Jun 6 '13 at 18:59