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 |
|
isihalin
Starting Member
6 Posts |
Posted - 2009-09-23 : 06:42:02
|
| HI All, I have been managing SQL server 2000 Database for my company.I have a Field Name called e_code (employee code which is unique)in a Master table and has been mapped as Foreign Key to more than 5 tables. Now that , our Employee code has been changed in the recent past, I need to update the employee code with one letter in-front of the existing e_code , now if this is for one or two i can manually update it. But it needs to be done for all Is there a way i can change the ecode for all with one update statement.Scenario: Exisiting Data : e_code='1011280' To be Changed : e_code='e1011280'Any help ?Thanks In Advance.isihalin |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-09-23 : 06:51:56
|
[code]update tset e_code = 'e' + e_codefrom yourtable t[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
isihalin
Starting Member
6 Posts |
Posted - 2009-09-25 : 05:13:22
|
HiThanks. It works.update tset e_code = 'e' + e_codefrom yourtable t[/code] KH[spoiler]Time is always against us[/spoiler][/quote]Thanks In Advance.isihalin |
 |
|
|
nalnait
Starting Member
14 Posts |
Posted - 2009-09-25 : 08:25:13
|
| 1?UPDATE TABLE SET col='e'+col2?alter foreign key as cascade update |
 |
|
|
|
|
|