I have a table with the following schema
F_NAME L_NAME COURSE_ID COURSE_DESC
this table contains 10 records ,and I need to insert these records into 2
tables .TBSTUDENT and TBCOURSE.
in TBSTUDENT ,I have student_id which is an identity column and in TBCOURSE
,I have a foriegn key to this field. How can I isert 10 records from the
first table into TBSTUDENT AND TBCOURSE ,where I should first get the
identity generated from the first insert and use it in the second
insert(into TBCOURSE).
ThanksDECLARE @.myID int
INSERT INTO ......
VALUES ......
SELECT @.myID = SCOPE_IDENTITY()
Message posted via http://www.webservertalk.com|||I have to insert into two tables at the same time?
I didn't get it!!!
Thanks
"E B via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:6bd904766fc843f1bc532d3a3cd059f1@.SQ
webservertalk.com...
> DECLARE @.myID int
> INSERT INTO ......
> VALUES ......
> SELECT @.myID = SCOPE_IDENTITY()
> --
> Message posted via http://www.webservertalk.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment