IF NOT EXISTS(SELECT 1 FROM syscolumns WHERE ID = OBJECT_ID('FP_CARGO_EST_PROD_TBL_COMIS') AND NAME = 'CD_GRP_ECON')
begin
ALTER TABLE dbo.FP_CARGO_EST_PROD_TBL_COMIS ADD
	CD_GRP_ECON int NULL

ALTER TABLE dbo.FP_CARGO_EST_PROD_TBL_COMIS ADD CONSTRAINT
	DF_FP_CARGO_EST_PROD_TBL_COMIS_CD_GRP_ECON DEFAULT 0 FOR CD_GRP_ECON

ALTER TABLE [dbo].[FP_CARGO_EST_PROD_TBL_COMIS] DROP CONSTRAINT [PK_FP_CARGO_EST_PROD_TBL_COMIS]

ALTER TABLE dbo.FP_CARGO_EST_PROD_TBL_COMIS ALTER COLUMN CD_GRP_ECON INT NOT NULL

ALTER TABLE dbo.FP_CARGO_EST_PROD_TBL_COMIS ADD CONSTRAINT
	PK_FP_CARGO_EST_PROD_TBL_COMIS PRIMARY KEY CLUSTERED 
	(
	CD_EMP,
	CD_CARGO,
	CD_TBL_COMIS,
	CD_GRP_ECON
	) WITH( PAD_INDEX = OFF, FILLFACTOR = 90, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
end


