IF  EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CTB_APURA_PIS_COFINS]') AND name = N'PK_CTB_APURA_PIS_COFINS')
BEGIN
	ALTER TABLE [dbo].[CTB_APURA_PIS_COFINS] DROP CONSTRAINT [PK_CTB_APURA_PIS_COFINS]
END
GO
	
	ALTER TABLE [CTB_APURA_PIS_COFINS]
	ALTER COLUMN [NAT_BC_CRED] INT NOT NULL;
	GO

	ALTER TABLE [dbo].[CTB_APURA_PIS_COFINS] ADD  CONSTRAINT [PK_CTB_APURA_PIS_COFINS] PRIMARY KEY CLUSTERED 
	(
		[CD_EMP] ASC,
		[CD_FILIAL] ASC,
		[MES_APURAC] ASC,
		[ANO_APURAC] ASC,
		[COD_CRED] ASC,
		[TIPO_REGISTRO] ASC,
		[CST_PIS] ASC,
		[CST_COFINS] ASC,
		[NAT_BC_CRED] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO


