IF EXISTS (SELECT * FROM SYS.tables WHERE NAME = 'CG_FND_VERBA_USO_CG_FND_VERBA')
BEGIN
	GOTO FINAL
END

CREATE TABLE [dbo].[CG_FND_VERBA_USO_CG_FND_VERBA](
	[CD_EMP] [int] NOT NULL,
	[CD_FND_VERBA_USO] [int] NOT NULL,
	[CD_FND_VERBA] [int] NOT NULL,
	
	CONSTRAINT [PK_CG_FND_VERBA_USO_CG_FND_VERBA] PRIMARY KEY CLUSTERED 
(
	[CD_FND_VERBA_USO] ASC,
	[CD_FND_VERBA] ASC,
	[CD_EMP] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]

FINAL:

GO


IF OBJECT_ID('FK_CG_FND_VERBA_USO_CG_FND_VERBA_CG_FND_VERBA') IS NOT NULL
BEGIN
	GOTO FINAL
END


ALTER TABLE [dbo].[CG_FND_VERBA_USO_CG_FND_VERBA]  WITH CHECK ADD  CONSTRAINT [FK_CG_FND_VERBA_USO_CG_FND_VERBA_CG_FND_VERBA] FOREIGN KEY([CD_FND_VERBA],[CD_EMP])
REFERENCES [dbo].[CG_FND_VERBA] ([CD_FND_VERBA],[CD_EMP])

ALTER TABLE [dbo].[CG_FND_VERBA_USO_CG_FND_VERBA] CHECK CONSTRAINT [FK_CG_FND_VERBA_USO_CG_FND_VERBA_CG_FND_VERBA]

FINAL: