php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81295 PDO_DBLIB: Run specific sql query get no result
Submitted: 2021-07-26 00:37 UTC Modified: 2021-07-27 01:44 UTC
From: bestlong168 at gmail dot com Assigned:
Status: Open Package: PDO DBlib
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bestlong168 at gmail dot com
New email:
PHP Version: OS:

 

 [2021-07-26 00:37 UTC] bestlong168 at gmail dot com
Description:
------------
The following SQL query run on MS Query, FreeTSD tsql will get 10 row result, but run dblib query get no result.

select row_num = identity(int,1,1), *
into #b_resources
from (
  select * from (select top 20 * from b_resources) A
  union all
  select * from b_resources where 1=2
) B;
select * from #b_resources where row_num between 11 and 20;
drop table #b_resources;


Test script:
---------------
$sql = 'select row_num = identity(int,1,1), * into #b_resources from (select * from (select top 20 * from b_resources) A union all select * from b_resources where 1=2 ) B; select * from #b_resources where row_num between 11 and 20;drop table #b_resources;';

$rows = [];
foreach($conn->query($sql) as $row) {
    $rows[] = $row;
}
dump($rows);

Expected result:
----------------
get 10 row result

Actual result:
--------------
no result

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-27 01:44 UTC] bestlong168 at gmail dot com
-Summary: run sql query get no result +Summary: PDO_DBLIB: Run specific sql query get no result -Operating System: Ubuntu 20.04.2 LTS +Operating System: Irrelevant -PHP Version: 7.4.21 +PHP Version: Irrelevant
 [2021-07-27 01:44 UTC] bestlong168 at gmail dot com
update PHP version and OS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 22:01:28 2024 UTC