tracker issue : CF-4205348

select a category, or use search below
(searches all categories and all time range)
Title:

QueryExectute returns NULL for INSERT/UPDATE with OUTPUT clause when no records are inserted

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/PRNeedInfo

Reporter/Name(from Bugbase): Chris H. / ()

Created: 10/01/2019

Components: Database, JDBC

Versions: 2016

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: update 12 / 2020.0.0.318009

Priority/Frequency: Normal / All users will encounter

Locale/System: / Windows 10 64 bit

Vote Count: 0

Problem Description:

I would see this as a bug but potentially a feature - i have also had reports of other people getting an empty resultset when using CF 2018 so there could well be inconsistency here as well.

Steps to Reproduce:

the following SQL in queryExecute with an SQL Server Database (testing with a 2008r2 server here)

```
DECLARE
    @from AS TABLE ( ID INT )
;

DECLARE
    @to AS TABLE ( ID INT )
;

/*INSERT INTO @from (id)
VALUES (1),(2)*/


INSERT INTO 
    @to 
OUTPUT 
    INSERTED.*
SELECT 
    * 
FROM 
    @from
```

Actual Result:

NULL when nothing is inserted and a query object when something is

Expected Result:

Always return a query object when an OUTPUT statement is the return and if there are 0 results return an empty query

Any Workarounds:

Attachments:

Comments:

Hi Chris, Is this the only SQL statement that I should use with the QueryExecute function in order to repro this issue? If no, please share the isolated repro case for this issue.   -Nimit
Comment by Nimit S.
31570 | October 09, 2019 05:32:09 AM GMT
Hi Chris, is there any update regarding issue.if you are still facing this issue, can you please provide me information which is mention in previous comment. Yogesh
Comment by Yogesh P.
33198 | February 26, 2020 12:05:05 PM GMT