doing a (not so simple) query -which works fine in sql server using PDO like this:
and get
Array ( [0] => HY000 [1] => 10024 [2] => SQL Server connection timed out. [10024] (severity 6) [select datepart(week,( clroot.dochdsal .date1)) as weekno,datepart (year,(clroot.d ochdsal.date1)) as yearno,clroot.l itmsale.linkid, SUM(clroot.litm sale.openqnt) AS ORDERQNT from clroot.dochdsal inner join clroot.litmsale on clroot.dochdsal .aa=clroot.litm sale.documentaa inner join clroot.DocParam on clroot.dochdsal .ParamsCode=clr oot.DocParam.co de where clroot.DocParam .updorder=1 AND clroot.DocParam .stocksign=0 and clroot.dochdsal .Type1<>3 and clroot.dochdsal .FlagTrans=0 and datepart(week,( clroot.dochdsal .date1)) = '40' and datepart(year,( clroot.dochdsal .date1)) = '2009' GROUP BY clroot.litmsale .linkid,clroot. litmsale.cmmnt, datepart(week,( clroot.dochdsal .date1)),datepa rt(year,(clroot .dochdsal.date1 ))] [3] => -1 [4] => 6 ) ERROR: Could not execute the query. 1
any ideas?
PS already memory_limit to 300M, mssql.timeout to 1000 and max_execution_t ime to 1000
Code:
// attempt a connection try { $pdo = new PDO("mssql:host=$hostname,1433;dbname=$dbname;",$username,$password); } catch (PDOException $e) { die("ERROR: Could not connect: " . $e->getMessage()); } // create and execute SELECT query $sql = "select datepart(week,(clroot.dochdsal.date1)) as weekno,datepart(year,(clroot.dochdsal.date1)) as yearno,clroot.litmsale.linkid,SUM(clroot.litmsale.openqnt) AS ORDERQNT from clroot.dochdsal inner join clroot.litmsale on clroot.dochdsal.aa=clroot.litmsale.documentaa inner join clroot.DocParam on clroot.dochdsal.ParamsCode=clroot.DocParam.code where clroot.DocParam.updorder=1 AND clroot.DocParam.stocksign=0 and clroot.dochdsal.Type1<>3 and clroot.dochdsal.FlagTrans=0 and datepart(week,(clroot.dochdsal.date1)) = '40' and datepart(year,(clroot.dochdsal.date1)) = '2009' GROUP BY clroot.litmsale.linkid,clroot.litmsale.cmmnt,datepart(week,(clroot.dochdsal.date1)),datepart(year,(clroot.dochdsal.date1))"; if ($result = $pdo->query($sql)) { while($row = $result->fetch()) { echo $row[0] . ":" . $row[1] . "\n"; } } else { echo "ERROR: Could not execute the query. " . print_r($pdo->errorInfo()); } // close connection unset($pdo);
Array ( [0] => HY000 [1] => 10024 [2] => SQL Server connection timed out. [10024] (severity 6) [select datepart(week,( clroot.dochdsal .date1)) as weekno,datepart (year,(clroot.d ochdsal.date1)) as yearno,clroot.l itmsale.linkid, SUM(clroot.litm sale.openqnt) AS ORDERQNT from clroot.dochdsal inner join clroot.litmsale on clroot.dochdsal .aa=clroot.litm sale.documentaa inner join clroot.DocParam on clroot.dochdsal .ParamsCode=clr oot.DocParam.co de where clroot.DocParam .updorder=1 AND clroot.DocParam .stocksign=0 and clroot.dochdsal .Type1<>3 and clroot.dochdsal .FlagTrans=0 and datepart(week,( clroot.dochdsal .date1)) = '40' and datepart(year,( clroot.dochdsal .date1)) = '2009' GROUP BY clroot.litmsale .linkid,clroot. litmsale.cmmnt, datepart(week,( clroot.dochdsal .date1)),datepa rt(year,(clroot .dochdsal.date1 ))] [3] => -1 [4] => 6 ) ERROR: Could not execute the query. 1
any ideas?
PS already memory_limit to 300M, mssql.timeout to 1000 and max_execution_t ime to 1000
Comment