For some reason I feel like I'm going about this the painful way. I have an INSERT xml list. I'm using XML because I need to pass in more than one dynamic value. Since we're saving the event, I already have that ID. What I won't know is the Group or Room ID, so I'm using XML to essentially pass in a datatable.
Here is an example INSERT portion:
IF @eventGroupTagRoomListInsert IS NOT NULL
BEGIN
INSERT INTO EventGroupTagRoomLink(EventID, RoomID, GroupTagID, IsDeleted, LastModifiedBy, SessionID)
SELECT
@eventID AS EventID,
ParamValues.Id.query('RoomId').value('.', 'int') AS RoomID,
ParamValues.Id.query('GroupTagID').value('.', 'int') AS GroupTagID,
0 AS IsDeleted,
@lastModifiedBy AS LastModifiedBy,
@sessionId AS SessionID
FROM @eventGroupTagRoomListInsert.nodes('/Entities/entity') AS ParamValues(ID)
IF @@ERROR <> 0 GOTO ERR_HANDLER
END
Is there cleaner way to do this?