Using SQL syntax

Using SQL syntax

DECLARE @result TABLE ( bid bigint, rid bigint );
INSERT INTO EcENTITY (comm_dir, bulk_id, ent_class_id, name)
OUTPUT INSERTED.bulk_id, INSERTED.ID INTO @result
VALUES ( 1, ISNULL((SELECT MAX(bulk_id) FROM EcENTITY), 0) + 1, N'ITEM', N'ARTKL-10001');
SELECT * FROM @result;