Title:
QueryExectute returns NULL for INSERT/UPDATE with OUTPUT clause when no records are inserted
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/PRNeedInfo
Reporter/Name(from Bugbase): Chris H. / ()
Created: 10/01/2019
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: