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.
| Author |
Topic |
|
indraja
Starting Member
6 Posts |
Posted - 2007-02-09 : 02:55:49
|
| I have an employeemaster table, department and designtion table.I have to initialise departmentid, designationid and managerid to employees in employeemaster and ManagerId is also employeeid the foreign key to the employeeid(self join).So how can i insert the first employee where there is no employeeid declared to assign managerid. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-09 : 03:04:16
|
can you post the table structure for these 3 tables ? KH |
 |
|
|
indraja
Starting Member
6 Posts |
Posted - 2007-02-09 : 03:12:03
|
quote: Originally posted by khtan can you post the table structure for these 3 tables ? KH
DepartmentMaster(DeptId int PRIMARY KEY,deptcode varchar) DesignationMaster(desgnid int PRIMARY KEY,desgncode varchar)employeemaster(empid int PRIMARY KEY,empname varchar,deptid int FOREIGN KEY(depatment table),desgnid int FOREIGN KEY(designation table),managerid int FOREIGN KEY (Employee table) |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-09 : 04:20:22
|
| You can either keep managerid for the first employee as his own employeeid or you can keep it NULL.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-09 : 04:24:26
|
quote: So how can i insert the first employee where there is no employeeid declared to assign managerid.
Create the manager's record first.For the manager record what do you intend to set the managerid as ? KH |
 |
|
|
|
|
|