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 |
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2007-11-20 : 14:36:57
|
| I need to update the data in one table with dat from another.i have a table called tblclients and a column called intethnicity. I also have a table called tblethnicity. The column in the table intethnicity should be the primary key integer for the corresponding ethnicity. So since most of the clients are caucasian, and the id for caucasian is 4, the intethnicity column should be 4.Here is the problem:I have a table of 1300 hundred records and the column intethnicity now has the actual ethnicity in it instead of the corresponding id for the ethnicity. I need a way to update all the records so that the intethnicity column has the id for the corresponding ethnicity, not the actual ethnicity itself.I know I can go uodate tblcients set intethnicityid =4 where intethnity ='white', but that would take too long.I need a way to update the column based on the id from the table ethnicity.Any help would be appreciated. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-20 : 14:57:44
|
| Please post a data example of your problem.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2007-11-20 : 15:04:51
|
| i'm glad you asked that. what is the proper way to post a data example? what kind of data do you want? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-20 : 15:09:32
|
| It's best to format the data so that it is easily readable. To retain formatting here, put code tags around it. We want enough sample data that illustrates your data. It typically takes about 5-10 rows to do this. And it doesn't have to be real data, but it does need to illustrate your problem.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
Butterfly82
Starting Member
30 Posts |
Posted - 2007-11-21 : 10:13:14
|
| Did you solve this problem? Butterfly82 |
 |
|
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2007-11-27 : 23:41:04
|
| no I did not solve the problem. I got stuck trying to find out the proper was to post sample data. can you show me how to post sample data, or point me to an example? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-28 : 01:27:15
|
quote: Originally posted by kifeda no I did not solve the problem. I got stuck trying to find out the proper was to post sample data. can you show me how to post sample data, or point me to an example?
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|