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 - 2008-08-26 : 17:46:02
|
| I have a table called tblclients and I have another table called tblclients2. I want copy the a field called f4 from tblclients2 into tblclients. This is what I tried:select f4 as strinsurancenumber into tblclients from tblclients2that gives me an error that says the table already exist. What should I do? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-08-26 : 17:47:09
|
| Does the column already exist in tblclients? Are you just trying to update the data? Or do you want a new column with data put into it?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2008-08-27 : 13:33:13
|
| the column does not exist |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-27 : 13:40:12
|
then create it and updateALTER TABLE tblclients ADD strinsurancenumber varchar(20)UPDATE tSET t.strinsurancenumber=t2.f4FROM tblclients tINNER JOIN tblclients2 t2ON t.linkingcol=t2.linkingcol where linkingcol is the column by which the tables are related |
 |
|
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2008-08-27 : 13:44:25
|
| okay I'll try |
 |
|
|
|
|
|