CREATE TABLE [dbo].[Cbtes_Items_XCampos](
	[Id_Trans] [int] NOT NULL,
    [Item] [smallint] NOT NULL,
	[Id_Campo] [int] NOT NULL,
	[Valor_String] [varchar](101) NULL,
	[Valor_Integer] [int] NULL,
	[Valor_DT] [datetime] NULL,
	[Valor_Decimal] [decimal](20, 4) NULL,
	[Valor_Memo] [text] NULL,
 CONSTRAINT [PK_Cbtes_Items_XC_PorId] PRIMARY KEY CLUSTERED 
(
	[Id_Trans] ASC,
	[Item] ASC,
	[Id_Campo] ASC
)
)

GO


ALTER TABLE [dbo].[Cbtes_Items_XCampos]  ADD  CONSTRAINT [FK_CbtiXC_Cbtes] FOREIGN KEY([Id_Trans],[Item])
REFERENCES [dbo].[Cbtes_Items] ([Id_Trans],[Item])
GO


ALTER TABLE [dbo].[Cbtes_Items_XCampos]  ADD  CONSTRAINT [FK_CbtiXC_XCampos] FOREIGN KEY([Id_Campo])
REFERENCES [dbo].[xCampos] ([Id_Campo])
GO

