[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SQL action statement question

Posted on 1998-05-14
5
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
faster earned 300 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

656 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