Solved

SQL action statement question

Posted on 1998-05-14
5
172 Views
Last Modified: 2010-08-05
I am trying to bring data from one table into another, and the INSERT INTO with a nested SELECT statement works fine, with one exception.  Some of the fields from the source table, although their names don't match, are needed to be brought across into the correct field.  For example, both tables might have FROM and TO fields, so they map across easily, but one table has FROM_____V and TO_______V which map to FROM_Special and TO_Special respectively.  Is there any way that I can map the fields using the INSERT INTO with SELECT statement I described above?  If there isn't a way using that statement, how about in another way?  Any help would be greatly appreciated. =)
0
Comment
Question by:S_Charette
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
faster earned 100 total points
ID: 1177519
You can first execute the select statement on the source, then save the fields in memory variable so that you can then issue an insert to the target, of course, this way you need a loop.
0
 

Author Comment

by:S_Charette
ID: 1177520
Any way to do it without the loop?
0
 
LVL 7

Expert Comment

by:faster
ID: 1177521
A loop is quit simple and I don't think that it will be inefficient.
0
 

Author Comment

by:S_Charette
ID: 1177522
Well, on a 28MB file, a loop is unefficient enough to make a difference.  Looks like I don't have much of a choice, tho :)  Thanks
0
 

Author Comment

by:S_Charette
ID: 1177523
Actually, I just figured it out... in the SELECT statement I need to use table.field AS [new field name] =)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

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