IF EXISTS (SELECT 1 FROM SYS.TABLES WHERE NAME='LD0P0SAVEDCOMPONENTS')
BEGIN
DROP TABLE LD0P0SAVEDCOMPONENTS
END
;
CREATE TABLE LD0P0SAVEDCOMPONENTS(
	ID INT IDENTITY(1,1) PRIMARY KEY,
	PROCESSMETADATAID INT NOT NULL,
	STEPCOMPONENTMAPPINGID INT NOT NULL,
	FOREIGN KEY (PROCESSMETADATAID) REFERENCES LD0P0PROCESSMETADATA(ID),
	FOREIGN KEY (STEPCOMPONENTMAPPINGID) REFERENCES LD0P0PROCESSSTEPCOMPONENTMAPPING(ID)
)
;
IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME='LD0V0SAVEDCOMPONENTS')
BEGIN
DROP VIEW LD0V0SAVEDCOMPONENTS
END
;
CREATE VIEW LD0V0SAVEDCOMPONENTS
	AS SELECT * FROM LD0P0SAVEDCOMPONENTS
;