IF NOT EXISTS (SELECT 1 FROM SYS.TABLES WHERE NAME='LD0P0T45')
BEGIN
CREATE TABLE LD0P0T45(
	REDPDFNR decimal(9, 0) NOT NULL,
	PARENTDOCUMENTID varchar(50) NOT NULL,
	DOKTYP decimal(9, 0) NOT NULL,
	DATUM varchar(8) NOT NULL,
	FILENAME varchar(50) NOT NULL,
	FILEID varchar(38) NOT NULL,
	UPDDAT varchar(8) NOT NULL,
	UPDSIGN varchar(10) NOT NULL,
	DELETED BIT NOT NULL,
	ISLOCKED BIT NOT NULL, 
  CONSTRAINT PK_LD0P0T45 PRIMARY KEY CLUSTERED (REDPDFNR)

) 
END
GO
CREATE INDEX LD0I0T45 ON LD0P0T45 (PARENTDOCUMENTID);
GO
CREATE SEQUENCE LD0P0T45_Seq 
		AS DECIMAL(9)
		START WITH 1
		MINVALUE 0
		MAXVALUE 999999999
		INCREMENT BY 1
		CACHE 50
GO
ALTER TABLE LD0P0T45 ADD  CONSTRAINT DF_Seq_LD0P0T45  DEFAULT (NEXT VALUE FOR LD0P0T45_Seq) FOR REDPDFNR
GO

CREATE OR ALTER VIEW LD0V0T45  
  AS SELECT * FROM LD0P0T45  
 GO


