Actually i am having three tables (registration,access,user_access) here what i want is i am inserting a record in registration table,at the same time i want to insert all the records(records are in static) in access table to user_access table with registration_id.........
example:
//i inserted one record in registration table
------------------------------------------------------------------------------
registration_id | username | loginid | password ------------------------------------------------------------------------------
1 | nitish | ab@gmail.com | 12345
at the same time i already having 3 records(static) in access table as shown bellow
-------------------------------------------------------------------------------
accessid | description | active
-------------------------------------------------------------------------------
1 | reports | 1
2 | leads | 1
3 | import | 1
i want to insert access records in user_access table with registration_id looks like below table
------------------------------------------------------------------------------
registration_id | access_id | active
---------------------------------------------------------------------------------
1 | reports | 1
1 | leads | 1
1 | import | 1
actually i am unable to explain my problem clearly......
this was my stored procedure code
if @option='InsertRegistrationDetails'
begin
insert into School_Details(School_Name,Address,Email_ID,Mobile_No,Fax_No,City,State,Country,Zip_Code,Created_On)values(@School_Name,@Address,@Email_ID,@Mobile_No,@Fax_No,@City,@State,@Country,@Zip_Code,getdate())
insert into Login_Details(School_ID,First_Name,Login_id,Password,Status,Designation,Created_on)values(@School_ID,@First_Name,@Login_id,@Password,@Status,@Designation,getdate())
update login_details set school_id=(select School_ID from school_details where school_name=@School_Name) where Login_id=@Login_id
end