title: PHP pdo query execution error
body: <p>I use php with pdo and <code>pdo_dblib</code> to execute long select query (in this case). If I run this query directly in sql I receive results but if I run it from php I receive </p>
  
  <p><code>207 General SQL Server error: Check messages from the SQL Server [207] (severity 16) [(null)]</code></p>
  
  <p>I use <code>debugDumpParams</code> to see what is the query after preparation but it dumps only the first 500 characters from the query and may be this is the problem. Is this some configuration parameter or this is a bug?</p>
  
  <p>OS: Slackware
  PHP: 5.4.7
  pdo_dblib - compiled by myself
  freetds - from <a href="http://slackbuilds.org/" rel="nofollow noreferrer">http://slackbuilds.org/</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13016978/is-there-a-maxium-to-the-output-of-pdodebugdumpparams">Is there a maxium to the output of PDO::debugDumpParams?</a></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Code:</p>
  
  <pre><code>&lt;?php
  $dsn = 'dblib:host=XXXXXXXX;dbname=XXXXX';
  $username='XXXXX';
  $password='XXXXXXX';
  
  
  $query = "select * from (
                  select Row_Number() over (order by 
                  order_status.id desc) as RowIndex,  
                  order_status.id as ID,
                  order_status.caller_type_id as CALLER_TYPE_ID,
                  order_status.phone as PHONE,
                  order_status.order_number as ORDER_NUMBER,
                  order_status.caller_client_data_id as CLIENT_DATA_ID,
                  order_status.caller_contact_phone_id as CALLER_CONTACT_PHONE_ID,
                  order_status.record_date as DATE,
                  order_status.call_date as CALL_DATE,
                  order_status.call_time as jueCALL_TIME,
                  order_status.username as USERNAME,
                  client_data.ID as CALLER_ID,
                  client_data.client_type_id as CLIENT_TYPE_ID,
                  client_data.name as NAME,
                  client_data.person as PERSON,
                  client_data.country_id as COUNTRY_ID,
                  client_data.city as CITY,
                  client_data.street as STREET,
                  client_data.street_number as STREET_NUMBER,
                  client_data.living_complex as LIVING_COMPLEX,
                  client_data.building as BUILDING,
                  client_data.entrance as ENTRANCE,
                  client_data.floor as FLOOR,
                  client_data.apartment as APARTMENT,
                  client_data.postal_code as POSTAL_CODE,
                  client_data.description as DESCRIPTION,
                  client_data.email as EMAIL,
                  country.name as COUNTRY,
                  client_type.type as CLIENT_TYPE,
                  caller_type.name as CALLER_TYPE,
                  contact_phone.phone as CALLER_CONTACT_PHONE
                  from order_status order_status
                  inner join client_data client_data on client_data.id = order_status.caller_client_data_id
                  inner join client_type client_type on client_type.id = client_data.client_type_id
                  inner join country country on country.id = client_data.country_id
                  inner join caller_type caller_type on caller_type.id = order_status.caller_type_id
                  inner join contact_phone on contact_phone.id = order_status.caller_contact_phone_id
               where 1=1 ) as Sub Where Sub.RowIndex &gt;= ? and Sub.RowIndex &lt; ?";
  
  
  $db = new PDO($dsn, $username, $password);
  $prepare = $db-&gt;prepare($query, array(PDO::ATTR_CURSOR =&gt; PDO::CURSOR_FWDONLY));
  $bind = array(1, 11);
  if (!$prepare-&gt;execute($bind)) {
      $prepare-&gt;debugDumpParams();
  } else {
      echo "success";
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>SQL: [1841] select * from (
                  select Row_Number() over (order by 
                  order_status.id desc) as RowIndex,  
                  order_status.id as ID,
                  order_status.caller_type_id as CALLER_TYPE_ID,
                  order_status.phone as PHONE,
                  order_status.order_number as ORDER_NUMBER,
                  order_status.caller_client_data_id as CLIENT_DATA_ID,
                  order_status.caller_contact_phone_id as CALLER_CONTACT_PHONE_ID,
                  order_status.record_date as DATE,
                  order_status.call_date as CALL_DATE,
                  order_status.call_time as jueCALL_T
  Params:  2
  Key: Position #0:
  paramno=0
  name=[0] ""
  is_param=1
  param_type=2
  Key: Position #1:
  paramno=1
  name=[0] ""
  is_param=1
  param_type=2
  </code></pre>