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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Aligning pk and fk - problems

Author  Topic 

PaulNeil
Starting Member

9 Posts

Posted - 2007-07-16 : 00:26:56
Hi,

Just new to SQL Server. Here is a create statement for the tables.

CREATE TABLE [T1] (
[ID] IDENTITY(1000, 2) NOT NULL,
[NAME] VARCHAR(100),
[SERV_TYPE] VARCHAR(40),
[NWT] VARCHAR(40),
[ROWVERSION] TIMESTAMP,
CONSTRAINT [T1_ID] PRIMARY KEY ([T1_ID])
)
GO


CREATE TABLE [T2] (
[ID] INT NOT NULL,
[CONTACT_TYPE] VARCHAR(1),
[CONTACT_NAME] VARCHAR(40),
[CONTACT_1] VARCHAR(100),
[CONTACT_2] VARCHAR(50),
[ROWVERSION] TIMESTAMP,
CONSTRAINT [PK_T2] PRIMARY KEY ([ID])
)
GO

ALTER TABLE [T2] ADD CONSTRAINT [T1_T2]
FOREIGN KEY ([ID]) REFERENCES [T1] ([ID])
GO

My problem remains how can I get T1.ID to automatically copy into T2.ID, when I have opened the table, T2 for data entry.

Thanks you guys for your help.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-16 : 00:29:39
duplicate thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=86410

Please avoid cross post


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -