Use SCOPE_IDENTITY
to recover the id of the insertion and thus be able to work with it. Therefore I know that with insert
it works.
The question is, does it work with the update
? I have tried to follow a similar process and it returns null.
In case it does not work, any way to do it? Do I have to declare variables and set them?
Example of a non-functional update:
UPDATE
[XXX].[dbo].[FirmanteActaModeloGeneral]
Set [Tratamiento] = 'D.'
, [NombreFirmante] = 'NombreFirmante'
, [Apellido1Firmante] = 'Apellido1Firmante'
, [Apellido2Firmante] = 'Apellido2Firmante'
, [CargoFirmante] = 'CargoFirmante'
, [PosicionFirmaActaAraba] = 0
, [PosicionFirmaActaBizkaia] = 0
, [PosicionFirmaActaGipuzkoa] = 0
WHERE
IdFirmante =30;
SELECT SCOPE_IDENTITY();