What I have is an array of objects and I need to update the DB layer based on that array.
If the object contains id
property - Update query, if it doesn't - Insert query.
What I end up with is
BEGIN TRY
BEGIN TRANSACTION
UPDATE {...}
INSERT INTO {...}
UPDATE {...}
INSERT INTO {...}
{...}
COMMIT
END TRY
BEGIN CATCH
ROLLBACK
THROW
END CATCH
What can I do so that as a result of this query I can then fetch every row that has been affected (either modified or inserted) ?