Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How Is this Possible?

Author  Topic 

majidbhutta
Starting Member

13 Posts

Posted - 2005-11-28 : 11:52:25
In sql database , I have two tables named Emp_Info and Emp_Experience
the structure of table is like this;
Emp_Info
========
Emp_Id PrimaryKey(Auto)
Emp_Name
Emp_Age

Emp_Experience
==============
Exp_Id PrimaryKey(Auto)
Emp_Id ForeignKey
Exp_Detail
Exp_Year
. . . . ... and so on

Working on a single form, All these fields have to be enterd and are saved against one button click.The Problem is how can i get the Emp_Id for Emp_Experience table to save Experince and Emp_Info paralelly.The relationship btw Emp_Info and Emp_Experience is one to many. that is, Against one Employee there may be none or many Experiences.
in the scenario, i have to add Experiences first and then save the Employee? What 2 do? any guide line, help .....>?
i need its stored procedure for saving Experiences.
Thnx in Advance

nr
SQLTeam MVY

12543 Posts

Posted - 2005-11-28 : 11:57:28
>> i have to add Experiences first and then save the Employee?
Don't.
Add the employee first - you will need that for the Emp_Id in Emp_Experience.
If necessary just add a stub and update with the correct data later.

>> i need its stored procedure for saving Experiences
All database access should be via stored procedures.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -