If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Insert contents of Col in one table into another table
Hello:
Is it possible in Access to insert the contents of a column from one table into another table? When I run a Sql statement, it pretends to be inserting (or doing something - hourglass) and when I view the table, nothing has been done. This is my SQL statement: Insert into table1 (col2) Select ColA from table2; What am I doing wrong? Any help you can give me will save me lots of grief!! Sandy |
#2
|
|||
|
|||
Insert contents of Col in one table into another table
On Thu, 27 May 2004 17:36:01 -0700, "Sandy"
wrote: Hello: Is it possible in Access to insert the contents of a column from one table into another table? When I run a Sql statement, it pretends to be inserting (or doing something - hourglass) and when I view the table, nothing has been done. This is my SQL statement: Insert into table1 (col2) Select ColA from table2; What am I doing wrong? Any help you can give me will save me lots of grief!! Sandy An INSERT query creates *new records* in the target table. In this case, if Table2 had 2000 records, the query would create 2000 new records in Table1 - unless Table1 has required fields other than Col2. If you want to put the value in ColA into the field Col2 in *existing* records in Table1, you will need instead to use an UPDATE query, joining the two tables on a unique field so that it is unambiguous what record you're updating. It appears that you may be using "spreadsheet logic" here - a sure and certain way to get into trouble! What are these tables, and how are they related? What actual data are you trying to transfer? John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
#3
|
|||
|
|||
Insert contents of Col in one table into another table
Hello, John -
You are right - I was using "spreadsheet logic" - don't ask me why. Thanks for pointing that out. Sandy |
Thread Tools | |
Display Modes | |
|
|