Solved

SQL action statement question

Posted on 1998-05-14
5
181 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.

912 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

25 Experts available now in Live!

Get 1:1 Help Now