Insert Statement

Posted on 2015-01-07
Last Modified: 2015-01-07

Will a INSERT statement work for taking a record from one table to another?
Question by:Jass Saini
  • 4
  • 3
  • 2
  • +1
LVL 19

Expert Comment

by:Eric Sherman
ID: 40536059
Yes, can you be a little more specific in what you are trying to accomplish.

LVL 119

Expert Comment

by:Rey Obrero
ID: 40536061

Insert into tablex(f1,f2)
select f1,f2 from tableY
LVL 18

Expert Comment

ID: 40536069
Insert into tbl1 (txtCol)
select txtAnotherCol from tbl2

Author Comment

by:Jass Saini
ID: 40536082
Would it be okay to insert from one table to another when the col are different or do they have to be the same.  Where in the property should the action happen?
LVL 119

Expert Comment

by:Rey Obrero
ID: 40536114
the names of columns may not be the same, BUT the number of columns must be the Same and the Data types must be the same.
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

LVL 18

Assisted Solution

SimonAdept earned 250 total points
ID: 40536115
The order of the values clause and the select clause are what matters

insert into t1 (col3,col1)
select col2,col4 from t2

In this case col2 gets inserted in col3 of the table t1 and col4 gets inserted into col1 of t1.

Datatypes should be the same or coercible (e.g. numeric to string, but not alphanumeric string to numeric);.

Author Comment

by:Jass Saini
ID: 40536149
So should I use a COPY button to to copy that over...also...sorry forget this ..

Some of my fields that I need to copy are on the main form and others are the sub form.  Will that be okay?
LVL 119

Accepted Solution

Rey Obrero earned 250 total points
ID: 40536210
omg,,, @JAss SAini
please stick to the original problem that you posted..
when you got a solution, close the thread AND OPEN a new question for another problem.

Author Comment

by:Jass Saini
ID: 40536223
OK Thank you is still part of the same problem.

Author Closing Comment

by:Jass Saini
ID: 40536224
Thank you

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now