emplyoee (first table)
id primary key auto increment
emp_name varchar
student(second table)
id foriegnkey emplyoee.id
st_name varchar
i want to insert multiple student records for a single employe id . My code is attached here , but this use to only one student record update.how can i write stored procedure for this need.
i am new with SQL server and stored procedure , could you please help me.
Hide Copy Code
create procedure empst_Sp @emp_name varchar(50), @st_name varchar(50) as begin insert into emplyoee (emp_name) values (@emp_name) insert into student(id,st_name) values(SCOPE_IDENTITY(),@st_name) end
Manoj Kumar MandalPosted Apr 30, 2015, 2:33 AM
Create A datatable and fill that table with student details in c#.
Pass that data table along with employee details(normal parameter).
Check link http://www.c-sharpcorner.com/UploadFile/b63684/the-prologue/ to see how to pass datatable as parameter.