

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[EST_TRIB_CONF_INTER_NCM]') AND name = N'PK_EST_TRIB_CONF_INTER_NCM')
ALTER TABLE [dbo].[EST_TRIB_CONF_INTER_NCM] DROP CONSTRAINT [PK_EST_TRIB_CONF_INTER_NCM]

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_EST_TRIB_CONF_INTER_NCM_NR_NCM]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[EST_TRIB_CONF_INTER_NCM] DROP CONSTRAINT [DF_EST_TRIB_CONF_INTER_NCM_NR_NCM]
END

ALTER TABLE EST_TRIB_CONF_INTER_NCM ALTER COLUMN NR_NCM VARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL


ALTER TABLE [dbo].[EST_TRIB_CONF_INTER_NCM] ADD  CONSTRAINT [PK_EST_TRIB_CONF_INTER_NCM] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_CTR] ASC,
	[NR_NCM] 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]


ALTER TABLE [dbo].[EST_TRIB_CONF_INTER_NCM] ADD  CONSTRAINT [DF_EST_TRIB_CONF_INTER_NCM_NR_NCM]  DEFAULT ((0)) FOR [NR_NCM]
