IF EXISTS (SELECT * FROM SYS.columns WHERE NAME = 'CD_CHAVE' AND OBJECT_ID = OBJECT_ID('GLB_CHAVE_FRM'))
	BEGIN
		
	
		ALTER TABLE GLB_CHAVE_FRM DROP CONSTRAINT PK_GLB_CHAVE_FRM;
		DROP INDEX IX_GLB_CHAVE_FRM ON GLB_CHAVE_FRM;

		ALTER TABLE GLB_CHAVE_FRM ALTER COLUMN CD_CHAVE VARCHAR(100) NOT NULL;

		ALTER TABLE [dbo].[GLB_CHAVE_FRM] ADD  CONSTRAINT [PK_GLB_CHAVE_FRM] PRIMARY KEY CLUSTERED 
		(
			[CD_FRM] ASC,
			[CD_CHAVE] 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, FILLFACTOR = 80) ON [PRIMARY];

		CREATE NONCLUSTERED INDEX [IX_GLB_CHAVE_FRM] ON [dbo].[GLB_CHAVE_FRM]
		(
			[CD_FRM] ASC,
			[CD_CHAVE] ASC
		)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY];

	END
