View Single Post
  #6 (permalink)  
Old June 30th, 2009, 06:13 PM
slake slake is offline
Authorized User
 
Join Date: Jun 2009
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
Default foreign key works but other data wont appear

Hi
I have created the trigger for my problem but then when i insert it all the other columns wont appear. Exampl

Student(studid,name,address) course(cid,coursename,date,stuid)
studid and cid are primary keys in there respective tables and forign key (studid) in course.

when i insert the vales in for everything except the primary and foreign key. all vales in the parent(student) table are generated.The child table will generate the first column with the foreign key and then another column without a foreign key.
So for every single parent column i generate 2 columns of the child table. Each having half of what i want. I need all the data to be insert in the same column


[CREATE TRIGGER TG_INS_STUDENT

ON dbo.STUDENT
FOR
INSERT
AS
BEGIN

INSERT INTO dbo.COURSE(STUDID)
SELECT STUDID FROM INSERTED
END]

please help me rectify it if you can i came so close.Look forwaard to hearing from you.

Last edited by slake; June 30th, 2009 at 06:40 PM.. Reason: Realised an error with the insertion
Reply With Quote