IF EXISTS (SELECT 1 FROM SYS.COLUMNS WHERE NAME = 'CD_CHAVE' AND OBJECT_ID = OBJECT_ID('GLB_CHAVE'))
BEGIN

ALTER TABLE GLB_CHAVE	DROP CONSTRAINT PK_GLB_CHAVE;

ALTER TABLE GLB_CHAVE ALTER COLUMN CD_CHAVE	NVARCHAR (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL;

ALTER TABLE GLB_CHAVE	ADD CONSTRAINT PK_GLB_CHAVE PRIMARY KEY (CD_CHAVE);

ALTER TABLE GLB_CHAVE_CPL	DROP CONSTRAINT PK_GLB_CHAVE_CPL;

ALTER TABLE GLB_CHAVE_CPL ALTER COLUMN CD_CHAVE	NVARCHAR (100)  COLLATE SQL_Latin1_General_CP1_CI_AS   NOT NULL;

ALTER TABLE GLB_CHAVE_CPL	ADD CONSTRAINT PK_GLB_CHAVE_CPL PRIMARY KEY (CD_CHAVE, CD_OPCAO);
END
