-- Check If view all_part exist
IF EXISTS (SELECT * FROM DBO.SYSOBJECTS where name = 'eq_status_pms_MPP')
-- Alter it if, it exist already
ALTER VIEW "AFM"."eq_status_pms_MPP"
AS
select ........
ELSE
-- Create it if, it not exist already
CREATE VIEW "AFM"."eq_status_pms_MPP"
AS
select ......
ENDIF
-- Grant view to AFM_Users group
GRANT ALL ON AFM.eq_status_pms_MPP TO A_USERS
|