declare @RoleActionTypes table(
	[Name] [nvarchar](50) NOT NULL,
	[guid] [uniqueidentifier] NULL
)

insert into @roleactiontypes (name,guid) values('OrganizationUnitRead','641087C9-A7EE-45FE-AA93-893707FD8A18')
insert into @roleactiontypes (name,guid) values('OrganizationUnitAdd','49A6B509-9C5F-409A-9469-176496E9C80A')
insert into @roleactiontypes (name,guid) values('OrganizationUnitEdit','31D95CBB-B341-410A-B8B7-FD7A9685273E')
insert into @roleactiontypes (name,guid) values('OrganizationUnitDelete','1AC1C216-7403-4657-B968-E96FC5D0D53A')
insert into @roleactiontypes (name,guid) values('DeviceAdd','12BB55A5-EE3D-4759-8147-93C1F6130367')
insert into @roleactiontypes (name,guid) values('DeviceEdit','214A539A-2C0E-4761-8551-866D95DDC85A')
insert into @roleactiontypes (name,guid) values('DeviceDelete','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @roleactiontypes (name,guid) values('DeviceRead','C77E1B9C-C59C-4003-AC35-31C1E3E4FED2')
insert into @roleactiontypes (name,guid) values('BatchRead','87EC56A0-AAB1-41B5-AB64-3C6A6D5D89E7')
insert into @roleactiontypes (name,guid) values('BatchCommandAdd','81F0E2D1-C469-4A55-AF24-1A4BB61C5B6F')
insert into @roleactiontypes (name,guid) values('BatchCommandCancel','BBA77A57-7B06-4503-8838-A48692A4EF4D')
insert into @roleactiontypes (name,guid) values('BatchRSUAdd','19D4B799-274B-449C-9172-570663382D68')
insert into @roleactiontypes (name,guid) values('BatchRSUCancel','7345D7FE-850B-4002-B960-202131CD7ECE')
insert into @roleactiontypes (name,guid) values('BatchConfigurationAdd','51051E8D-64E9-43DE-8A8B-E94D21F26943')
insert into @roleactiontypes (name,guid) values('BatchConfigurationCancel','7941180F-A491-4A04-8589-55E565BC317E')
insert into @roleactiontypes (name,guid) values('BatchUploadTemplate','27850967-76A7-455B-AF03-7FE02D1580F8')
insert into @roleactiontypes (name,guid) values('UserRead','E956D023-A3AB-47A2-B3BC-6BFF99337B10')
insert into @roleactiontypes (name,guid) values('UserAdd','27061901-5A98-4754-90E5-2D46243E5050')
insert into @roleactiontypes (name,guid) values('UserEdit','BC09021F-6411-45D1-8BB2-752BC8D0495F')
insert into @roleactiontypes (name,guid) values('UserDelete','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @roleactiontypes (name,guid) values('CVReportsRead','C216EC25-4665-48D3-83CC-ED85FF3AFE95')
insert into @roleactiontypes (name,guid) values('Monitoring','86EAECDA-918A-48EC-B3EC-49D3FEB3F492')
insert into @roleactiontypes (name,guid) values('ClinicalMonitoring','28DEAEA4-895D-4C48-A2D5-0C0E49126739')
insert into @roleactiontypes (name,guid) values('ThresholdEdit','37D22628-42ED-40F2-A531-116CA46BD1FA')
insert into @roleactiontypes (name,guid) values('Fit','1EBA1260-C867-47C0-90AD-E1F1372E4878')
insert into @roleactiontypes (name,guid) values('RuleRead','47D32A00-EE97-44C5-957F-45654C8A27CD')
insert into @roleactiontypes (name,guid) values('RuleEdit','B525BA9B-7A94-4B69-B03C-A6D61BFE133A')
insert into @roleactiontypes (name,guid) values('BatchAllowMultiAccountCall','96639387-41E7-4D17-97D8-F5B71277201B')
insert into @roleactiontypes (name,guid) values('BatchSaveTemplate','76086A65-F1F4-4E09-A5BC-F0C915B2A608')



MERGE INTO [dbo].RoleActionTypes AS TARGET
USING @RoleActionTypes AS SOURCE
	ON TARGET.guid = SOURCE.guid
	WHEN MATCHED THEN    
			UPDATE SET name=source.name
	WHEN NOT MATCHED BY TARGET THEN   
			INSERT ( name,guid) VALUES (Source.name, SOURCE.guid)  
OUTPUT $action, SOURCE.*;
