IF EXISTS (SELECT 1 FROM SYS.TABLES WHERE NAME='LD0P0STATISTICSTEMPLATE')
BEGIN
DROP TABLE LD0P0STATISTICSTEMPLATE
END
;
IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME='LD0V0STATISTICSTEMPLATE')
BEGIN
DROP VIEW LD0V0STATISTICSTEMPLATE
END
;
CREATE TABLE LD0P0STATISTICSTEMPLATE
(
	ID int IDENTITY(1,1) NOT NULL,
	TEMPLATENAME varchar(450) NULL,
	STATISTICSTYPE varchar(450) NULL,
	STATISTICSCRITERIAID int NOT NULL,
	ISGLOBAL bit NULL,
	CREATEDDATE datetime NULL,
	CREATEDBY varchar(450) NULL,
	UPDATEDDATE datetime NULL,
	UPDATEDBY varchar(450) NULL,
PRIMARY KEY CLUSTERED 
(
	ID ASC
)
)
;
CREATE VIEW LD0V0STATISTICSTEMPLATE
	AS SELECT * FROM LD0P0STATISTICSTEMPLATE
;


