Page 1 of 1

TMSQuery and RowsAffected

Posted: Fri 07 Oct 2016 10:14
by LHSoft
Hello,
I want to insert a new row into a table with an autoincrement field and want to know the autoincrement value after row inserted.
usually I use TMSSQL but I want a feedback so I think Ihave to use TMSQuery instead with following example syntax:

Code: Select all

INSERT INTO Table (fieldA) 
OUTPUT Inserted.Id
VALUES ('xyz')
The statement works fine, but I get -1 as RowsAffected, but should be 1?
Is this a bug or a mistake on my side?

best regards
Hans

Re: TMSQuery and RowsAffected

Posted: Tue 11 Oct 2016 12:38
by azyk
We have investigated the behavior you described. The reason is that after execution of the INSERT INTO ... OUTPUT SQL query SQL Server returns us Rowset, but doesn't return the value of RowsAffected, and we can't affect this.