Anothersledhead
Posts: 44
|
| Posted: 01/03/2005, 9:23 PM |
|
Any sugestions on how to insert a series of records from one table to another. I have two tables quote_detail and invoice_detail and would like to populate the invoice table with data from my quote table.
Thanks for any help!
|
 |
 |
bmaclean
Posts: 7
|
| Posted: 01/09/2005, 11:34 PM |
|
If you're asking for the SQL, I can help:
INSERT INTO
<target_table> (<target_column_1>, <target_column_2> . . . )
SELECT <source_column_1>, <source_column_2> . . .
FROM <source_table>
WHERE . . .;
The things in <chevrons> are placeholders for actual table and column names. Use the WHERE clause to limit your SELECT to the appropriate rows.
If you are asking a CCS specific question, someone else will have to help, though I hope to know enough CCS in the future to help:)
Thanks,
Mac
|
 |
 |
bmaclean
Posts: 7
|
| Posted: 01/09/2005, 11:37 PM |
|
Forgot to mention: The source and target columns do not have to be the same name, but the data ypes have to be compatible. Also the target columns must have equal or longer length (in the case of varchars) or precision and scale (in the case of numbers) than the source columns.
Quote bmaclean:
If you're asking for the SQL, I can help:
INSERT INTO
<target_table> (<target_column_1>, <target_column_2> . . . )
SELECT <source_column_1>, <source_column_2> . . .
FROM <source_table>
WHERE . . .;
The things in <chevrons> are placeholders for actual table and column names. Use the WHERE clause to limit your SELECT to the appropriate rows.
If you are asking a CCS specific question, someone else will have to help, though I hope to know enough CCS in the future to help:)
Thanks,
Mac
|
 |
 |
|