May 26, 2010 at 3:02 am
Hi,
Currently i'm not able to think of any good solution. Can someone pls hep me
I have a table which can have same emp name and manager name. Now same employee cannot be his/her manager so I would like to pick these kind of rows and update the table with some predef.ined name.
For eg my table looks like
Emp_name Mgr_Name
abc1 xyz
abc abc
sdf xyz
xyz xyz
....
...
now this table has many rows.
May 26, 2010 at 3:05 am
this code will update the two names where the emp_name = mgr_name
UPDATE YourTable
SET Emp_name = 'predef.ined name', Mgr_Name = 'predef.ined name'
WHERE Emp_name = Mgr_Name
May 26, 2010 at 7:59 am
Also post some sample output based on the data you posted above
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
May 28, 2010 at 3:21 am
khushbu (5/26/2010)
Hi,Currently i'm not able to think of any good solution. Can someone pls hep me
I have a table which can have same emp name and manager name. Now same employee cannot be his/her manager so I would like to pick these kind of rows and update the table with some predef.ined name.
For eg my table looks like
Emp_name Mgr_Name
abc1 xyz
abc abc
sdf xyz
xyz xyz
....
...
now this table has many rows.
First I would say, it is a wrong design. You should use IDs in such scenarios. My name is Atif Sheikh and I am DBA in a company with almost 100 employees. There is another Atif Sheikh in the company and he is a developer, in another department. Now, there is a possibility that he can be my manager in some project(s) or vice versa. In this case, your solution will not work unless you define IDs for all employees and map Manager ID against each manager.
I hope you got my point.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply