List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 3 2001 1:18pm
Subject:Re: INSERT INTO SELECT ??
View as plain text  
At 12:53 PM +0800 10/3/01, chong wee siong wrote:
>Hi DBAs:
>   I want to copy TableA in DatabaseA to TableB in DatabaseB
>with changes in the attributes of the tables, what options do I have?
>
>I tried these:
>
>a) insert into TableB (id) select (id) from DatabaseA.TableA;
>this works
>b) insert into TableB (id,data) select (id,data) from DatabaseA.TableA;
>but this does not work, why? and how do I do this?

They syntax is illegal for your second attempt.  The column list for
the SELECT part shouldn't have parentheses around it:


insert into TableB (id,data) select id,data from DatabaseA.TableA;

Parentheses work in your first attempt because (id) is a simple
parenthesized expression that produces id as its value.

-- 
Paul DuBois, paul@stripped
Thread
"\n" is SLASH, N instead of <newline>Uriel Wittenberg2 Oct
  • Re: "\n" is SLASH, N instead of <newline>Benjamin Pflugmann2 Oct
  • Re: "\n" is SLASH, N instead of <newline>Uriel Wittenberg2 Oct
    • Re: "\n" is SLASH, N instead of <newline>Benjamin Pflugmann2 Oct
  • Re: "\n" is SLASH, N instead of <newline>Gerald Clark2 Oct
  • Re: "\n" is SLASH, N instead of <newline>Uriel Wittenberg3 Oct
    • Re: "\n" is SLASH, N instead of <newline>Benjamin Pflugmann3 Oct
  • INSERT INTO SELECT ??chong wee siong3 Oct
    • Re: INSERT INTO SELECT ??Paul DuBois3 Oct
  • Re: "\n" is SLASH, N instead of <newline> -- SOLUTION (why not mention it?)Uriel Wittenberg4 Oct
    • Re: "\n" is SLASH, N instead of <newline> -- SOLUTION (why not mention it?)Benjamin Pflugmann4 Oct
  • Re: "\n" is SLASH, N instead of <newline> -- SOLUTION (why not mention it?)Uriel Wittenberg4 Oct
    • Re: "\n" is SLASH, N instead of <newline> -- SOLUTION (why not mention it?)Benjamin Pflugmann4 Oct