[ ajz @ 29.04.2007. 14:42 ] @
E ovako imam jednu tabelu i kad u nju unesem neku vrstu treba u drugoj tabeli da se ubaci nova vrsta gde je foreign key = primary key iz prve tabele. ja sam mislio da to uradim tako sto uradim prvi insert i zapamtim koji je primary key i tu nastaje problem kako da ga zapamtim!!?? evo sta sam do sad napravio Code: ... -- Add the parameters for the stored procedure here @topicid int, @subject varchar(100), @replies int, @author varchar(100), @lastpostdate datetime, @thrid int, @message varchar(max) AS BEGIN SET IDENTITY_INSERT Threads ON -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here INSERT Threads (topicid, "subject", replies, author, lastpostdate) VALUES(@topicid, @subject, @replies,@author, @lastpostdate) --e asd valjda ovde bi trebalo da izvucem ovaj key iz prve tabele i da ga smestim u thrid jel da?? INSERT Messages (threadid, author, date, "message") VALUES(@thrid, @author, @lastpostdate, @message) END |