Код для создания таблицы DBSTATS.

IF EXISTS (SELECT * FROM sysobjects WHERE id =
 object_id(N?[dbo].[DBSTATS]?) AND 
OBJECTPROPERTY(id, N?IsUserTable?) = 1)
DROP TABLE [dbo].[DBSTATS]
GO

CREATE TABLE [dbo].[DBSTATS] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[RECORD_TYPE] [int] NOT NULL ,
	[DBNAME] [char] (50) NOT NULL ,
	[DATA_SIZE] [decimal](9, 2) NULL ,
	[DATA_USED] [decimal](9, 2) NULL ,
	[LOG_SIZE] [decimal](9, 2) NULL ,
	[LOG_USED] [decimal](9, 2) NULL ,
	[STAT_DATE] [datetime] NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[DBSTATS] WITH NOCHECK ADD
	CONSTRAINT [DF_DBSTATS_STAT_DATE] DEFAULT
 (getdate()) FOR [STAT_DATE]
GO

Поделитесь материалом с коллегами и друзьями