Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
udayfn12
Starting Member
15 Posts |
Posted - 2003-11-18 : 12:29:05
|
| Could some explain me why I can't have like this? Create Table Table1 ( [Cycle] [int] NOT NULL , [Docket] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED ( [Cycle], [Docket] ) WITH FILLFACTOR = 90 ON [PRIMARY] )Gocreate table Table2 ( [RunCycle] [int] NOT NULL , [VariableCycle] [int] NOT NULL , [Docket] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , CONSTRAINT [PK_Table2] PRIMARY KEY CLUSTERED ( [RunCycle], [VariableCycle], [Docket] ) WITH FILLFACTOR = 90 ON [PRIMARY] , CONSTRAINT [FK_Table2] FOREIGN KEY ( [RunCycle], [Docket] ) REFERENCES [Table1] ( [Cycle], [Docket] )) ON [PRIMARY]GOInsert Into Table1 values (200309,'08551')Insert Into Table1 values (200309,'04321')Insert Into Table1 values (200309,'02875')Insert into Table2 values (200309,200306,'08551')Insert into Table2 values (200309,200303,'08551')Insert into Table2 values (200309,200212,'08551')Insert into Table2 values (200309,200209,'08551')Insert into Table2 values (200306,200303,'08551')Insert into Table2 values (200306,200212,'08551')Insert into Table2 values (200306,200209,'08551')Insert into Table2 values (200306,200206,'08551')Thanks,Reddy |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-18 : 12:35:52
|
| Using your sample data, you would need 200306 to appear in Table1 in order for the INSERT to work.Tara |
 |
|
|
|
|
|
|
|