 

/****** Object:  Table [dbo].[PG_FORN_FORN_VINCULADO]    Script Date: 03/28/2014 11:43:48 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PG_FORN_FORN_VINCULADO]') AND type in (N'U'))
BEGIN
	RETURN
END
ELSE
BEGIN

	/****** Object:  Table [dbo].[PG_FORN_FORN_VINCULADO]    Script Date: 03/28/2014 11:43:50 ******/

	SET ANSI_NULLS ON
	SET QUOTED_IDENTIFIER ON
	SET ANSI_PADDING ON

	CREATE TABLE [dbo].[PG_FORN_FORN_VINCULADO](
		[CD_EMP] [int] NOT NULL,
		[CD_FORN] [int] NOT NULL,
		[CD_FORN_VINCULADO] [int] NOT NULL,
		[CD_USU] [int] NOT NULL,
		[DT_CAD] DATETIME NOT NULL,
	 CONSTRAINT [PK_PG_FORN_FORN_VINCULADO]PRIMARY KEY CLUSTERED 
	(
		[CD_EMP] ASC,
		[CD_FORN] ASC,
		[CD_FORN_VINCULADO] ASC
	)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 85) ON [PRIMARY]
	) ON [PRIMARY]

	SET ANSI_PADDING OFF

	ALTER TABLE [dbo].[PG_FORN_FORN_VINCULADO]  WITH NOCHECK ADD  CONSTRAINT [FK_PG_FORN_VINCULADO] FOREIGN KEY([CD_EMP], [CD_FORN])
	REFERENCES [dbo].[PG_FORN] ([CD_EMP], [CD_FORN])
	ON UPDATE CASCADE 
		ALTER TABLE [dbo].[PG_FORN_CD_FIL_FORN] CHECK CONSTRAINT [FK_PG_FORN_CD_FIL_FORN_PRC_FILIAL]
END
 

 