IF EXISTS (SELECT 1 FROM SYS.TABLES WHERE NAME='LD0P0LMSchemaRader')
BEGIN
DROP TABLE LD0P0LMSchemaRader
END
GO
IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME='LD0V0LMSchemaRader')
BEGIN
DROP VIEW LD0V0LMSchemaRader
END
GO
CREATE TABLE LD0P0LMSCHEMARADER
(
ID				DECIMAL(9) NOT NULL,
SCHEMAID  		DECIMAL(9) NOT NULL,
VECKANR   		DECIMAL(3) NOT NULL,
VECKODAG      	DECIMAL(3) NOT NULL,
FROMTID         VARCHAR(4) NOT NULL,
TOMTID          VARCHAR(4) NOT NULL,
TIDSAVDRAG    DECIMAL(3) NOT NULL,
UPDDAT         VARCHAR(8) NOT NULL,
UPDSIGN       VARCHAR(10) NOT NULL,
CONSTRAINT LD0P0LMSCHEMARADER_PKID PRIMARY KEY CLUSTERED
	(
	ID
	),
CONSTRAINT FK_LD0P0LMSCHEMARADER FOREIGN KEY (SCHEMAID)
    REFERENCES LD0P0LMSchema(ID) ON DELETE CASCADE
)
GO
CREATE VIEW LD0V0LMSchemaRader 
	AS SELECT * FROM LD0P0LMSchemaRader
GO
GRANT ALL ON LD0V0LMSchemaRader TO LD0ROANV
GO
