IF EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'AMBESTUPPDRAG'
          AND Object_ID = Object_ID(N'LD0P0I'))
BEGIN
ALTER TABLE LD0P0I DROP CONSTRAINT LD0P0I_AMBESTUPPDRAG
END
;
IF EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'AMBESTUPPDRAG'
          AND Object_ID = Object_ID(N'LD0P0I'))
BEGIN
ALTER TABLE LD0P0I DROP COLUMN AMBESTUPPDRAG
END
;

IF EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'AMANVISHANDL'
          AND Object_ID = Object_ID(N'LD0P0I'))
BEGIN
ALTER TABLE LD0P0I DROP CONSTRAINT LD0P0I_AMANVISHANDL
END
;

IF EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'AMANVISHANDL'
          AND Object_ID = Object_ID(N'LD0P0I'))
BEGIN
ALTER TABLE LD0P0I DROP COLUMN	AMANVISHANDL
END
;

DROP VIEW LD0V0I
;
CREATE VIEW LD0V0I AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V1I 
;
CREATE VIEW LD0V1I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V2I 
;

CREATE VIEW LD0V2I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V3I 
;

CREATE VIEW LD0V3I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V4I 
;

CREATE VIEW LD0V4I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V5I 
;

CREATE VIEW LD0V5I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V6I 
;
CREATE VIEW LD0V6I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V7I 
;

CREATE VIEW LD0V7I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V8I 
;
CREATE VIEW LD0V8I  AS
	SELECT * FROM LD0P0I
;

DROP VIEW LD0V9I 
;
CREATE VIEW LD0V9I  AS
	SELECT * FROM LD0P0I
;

GRANT ALL ON LD0P0I TO LD0ROANV
;

GRANT ALL ON LD0V0I TO LD0ROANV
;

GRANT ALL ON LD0V1I TO LD0ROANV
;

GRANT ALL ON LD0V2I TO LD0ROANV
;

GRANT ALL ON LD0V3I TO LD0ROANV
;

GRANT ALL ON LD0V4I TO LD0ROANV
;

GRANT ALL ON LD0V5I TO LD0ROANV
;

GRANT ALL ON LD0V6I TO LD0ROANV
;

GRANT ALL ON LD0V7I TO LD0ROANV
;

GRANT ALL ON LD0V8I TO LD0ROANV
;

GRANT ALL ON LD0V9I TO LD0ROANV
;
