Thanks to all.



CRPence <crp@xxxxxxxxxxxxxxxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
09/26/2007 03:14 PM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
midrange-l@xxxxxxxxxxxx
cc

Subject
Re: SQL - using INSERT with VALUES question






Basically what you have already tried, but resolving the requirements
of the SQL to make it happen without syntax errors:

INSERT INTO TABLEB
SELECT
A.*
, CURRENT TIMESTAMP AS X1 /* X1 names a field in TABLEA */
, CAST(NULL AS CHAR(1)) AS X2 /* X2 names a field in TABLEA */
FROM TABLEB A /* _A_ is used as a correlation identifier,
enabling use of * to denote /all fields/
rather than naming them on the SELECT */

The CAST was used just to show how that might be done. It could just
as easily have been the literal ' ', either with or without a CAST. The
field names [AS X#] are optional, but I prefer to name them for clarity,
the same as they are named in the file which is the target of the insert.

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.