IF	OBJECT_ID('PRC_FORN_DEV_POLITICA_ANEXO') IS NULL
begin
	CREATE TABLE dbo.PRC_FORN_DEV_POLITICA_ANEXO
		(
		CD_CTR int NOT NULL IDENTITY (1, 1),
		CD_EMP		int NOT NULL,
		CD_POLITICA int NOT NULL,
		ANEXO varbinary (MAX) NOT NULL,
		NOME_ARQUIVO VARCHAR(200) NULL,
		DATA_ANEXO datetime NOT NULL
		)  ON [PRIMARY]
	
	ALTER TABLE dbo.PRC_FORN_DEV_POLITICA_ANEXO ADD CONSTRAINT
		PK_PRC_FORN_DEV_POLITICA_ANEXO PRIMARY KEY CLUSTERED (CD_CTR) WITH
			( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

			
	ALTER TABLE [dbo].[PRC_FORN_DEV_POLITICA_ANEXO]  WITH NOCHECK ADD CONSTRAINT [FK_PRC_FORN_DEV_POLITICA_PRC_FORN_DEV_POLITICA_ANEXO] 
			FOREIGN KEY(CD_EMP, CD_POLITICA)
		REFERENCES [dbo].[PRC_FORN_DEV_POLITICA] (CD_EMP, CD_POLITICA)
		ON DELETE CASCADE;

	ALTER TABLE [dbo].[PRC_FORN_DEV_POLITICA_ANEXO] CHECK CONSTRAINT [FK_PRC_FORN_DEV_POLITICA_PRC_FORN_DEV_POLITICA_ANEXO]

END
