If possible, please add options for OUTPUT & INTO when part of an Insert, Update, or Delete. This is in SQL Server.
Also, it would be great to see in a SELECT if 'FOR' got the Before & After options. There is FOR JSON and FOR XML options.
FOR Clause (Transact-SQL) - SQL Server | Microsoft Learn
DELETE
FROM
dbo.p1tProjectNotes
OUTPUT
DELETED.id as id
, DELETED.Notes as Notes
INTO
#tMyDeleted
FROM
dbo.p1tProjectNotes as pn
WHERE EXISTS
(
SELECT
1
FROM
#tMyInts AS t
WHERE
t.id = pn.id
)
;
SELECT
@JsonOut =
(
SELECT
t.id,
t.Notes
FROM
#tMyDeleted AS t
FOR JSON PATH
)
;
IF @JsonOut IS NULL
BEGIN
SET @JsonOut = N'[]'
;
END
