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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2006-05-25 : 15:44:02
|
| I have two tables table1 and table2, both has same columns everything same.the first column in both the tables is ID which is a idnetity true column with increments 1.Can you please tell me, I am looking for a query how to upload the data from table2 into table1. except the id column since it is an identity column.Please help, thank you very much for the information. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-05-25 : 15:49:18
|
| UPDATE t1SET Column1 = t2.Column1, Column2 = t2.Column2, ...FROM Table1 t1INNER JOIN Table2 t2ON t1.[ID] = t2.[ID]Tara Kizeraka tduggan |
 |
|
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2006-05-25 : 16:16:34
|
| Hello Tara,I have 50K records in table1 and 30K records in table two, when i execute the above statement i want the total to become 80K.I see the above statement is using the Update instead of insert statement. I am counfused can you please help. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-05-25 : 16:20:31
|
| INSERT INTO Table1 (Column1, Column2, ...) <-- exclude IDSELECT Column1, Column2, ...FROM Table2Is that what you want?Tara Kizeraka tduggan |
 |
|
|
|
|
|