
declare @RoleAuthorizationActions table(
	actionid int NOT NULL,
	groupid int not NULL
)


--'Get Batches',					
insert into @RoleAuthorizationActions (actionid,groupid)
select a.id,g.id from roleactiontypes a , RoleAuthorizationGroupTypes g where g.guid ='1DB93246-E71B-4004-ACAA-F0DC4EF94100' and a.guid in ('87EC56A0-AAB1-41B5-AB64-3C6A6D5D89E7')
 


MERGE INTO [dbo].RoleAuthorizationActions AS TARGET
USING @RoleAuthorizationActions AS SOURCE
	ON TARGET.actionid = SOURCE.actionid and TARGET.groupid = SOURCE.groupid
	WHEN NOT MATCHED BY TARGET THEN   
			INSERT ( actionid,groupid) VALUES (Source.actionid, SOURCE.groupid)  
OUTPUT $action, SOURCE.*;

