To create a table for Table Constraint Maintenance. Script with drop and create.
USE [Work] --DB Name
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableConstraintMaintenance]') AND type in (N'U'))
DROP TABLE [dbo].[TableConstraintMaintenance]
GO
USE [Work]
GO
CREATE TABLE [dbo].[TableConstraintMaintenance](
[SchemaName] [varchar](10) NOT NULL,
[TableName] [varchar](255) NOT NULL,
[DropPK] [varchar](max) NULL,
[CreatePK] [varchar](max) NULL,
[DropIndex] [varchar](max) NULL,
[CreateIndex] [varchar](max) NULL,
[DropFK] [varchar](max) NULL,
[CreateFK] [varchar](max) NULL,
[DropRefFK] [varchar](max) NULL,
[CreateRefFK] [varchar](max) NULL,
[LastUpdateDate] [datetime] NULL,
CONSTRAINT [PK_TableConstraintMaintenance] PRIMARY KEY CLUSTERED
(
[SchemaName] ASC,
[TableName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
USE [Work] --DB Name
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableConstraintMaintenance]') AND type in (N'U'))
DROP TABLE [dbo].[TableConstraintMaintenance]
GO
USE [Work]
GO
CREATE TABLE [dbo].[TableConstraintMaintenance](
[SchemaName] [varchar](10) NOT NULL,
[TableName] [varchar](255) NOT NULL,
[DropPK] [varchar](max) NULL,
[CreatePK] [varchar](max) NULL,
[DropIndex] [varchar](max) NULL,
[CreateIndex] [varchar](max) NULL,
[DropFK] [varchar](max) NULL,
[CreateFK] [varchar](max) NULL,
[DropRefFK] [varchar](max) NULL,
[CreateRefFK] [varchar](max) NULL,
[LastUpdateDate] [datetime] NULL,
CONSTRAINT [PK_TableConstraintMaintenance] PRIMARY KEY CLUSTERED
(
[SchemaName] ASC,
[TableName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.