CREATE view csm_v_computer(uuid, dname, osim_target_type )
as
select c.uuid, c.dname, 1 as osim_target_type
from csm_object c, csm_property cp_bs
where c.class=102
and c.dname!=''
and cp_bs.object=c.id
and cp_bs.name='bootstatus'
union
select c.uuid, cp_mac.value, -1 as osim_target_type
from csm_object c, csm_property cp_bs, csm_property cp_mac
where c.class=102
and c.dname=''
and cp_bs.object=c.id
and cp_bs.name='bootstatus'
and cp_mac.object=c.id
and cp_mac.name='macaddr'
GO
GRANT SELECT ON [dbo].[csm_v_computer] TO [ams_group]
GRANT SELECT ON [dbo].[csm_v_computer] TO [ca_itrm_group]
GRANT SELECT ON [dbo].[csm_v_computer] TO [ca_itrm_group_ams]
GO