Getting SCOPE_IDENTITY() from SQL SERVER
Hi,
In a Business Operation i have the following code.
I need the identity of the latest row inserted in a table in MSSQL.
i Have the following code:
---------------------------------------------------------
set insertmaster= "INSERT INTO dbo.dataMasterArchive(deviceToPatientLogID) values (?)"
set tSC = ..Adapter.ExecuteUpdate(.nrows1,insertmaster,pRequest.deviceToPatientLogID)
$$$ThrowOnError(tSC)
set sql ="SELECT SCOPE_IDENTITY()"
set tSC = ..Adapter.ExecuteQuery(.tResult,sql)
$$$ThrowOnError(tSC)
set maxID = tResult.Get(1)
------------------------------------------------------------
the result of maxID after the above is NULL.
what am i doing wrong?.
Thanks
Product version: IRIS 2019.1