Subject | Re: [firebird-support] Re: Copying rows into tables |
---|---|
Author | Paul Vinkenoog |
Post date | 2005-03-03T15:33:31Z |
Hi yaedos2000,
columns. It seems that the two tables don't have the same number of
columns. As such this is not a problem, but then you have to be more
specific in what you insert and/or select:
INSERT INTO TargetTable (Field1, Field2, Field3, ... )
SELECT ThisField, ThatField, TheOtherField, ... FROM SourceTable
WHERE ...
Number and type of the named fields must match, that is: ThisField
must be assignment-compatible with Field1, ThatField with Field2, etc.
If the field list for TargetTable happens to match * for that table,
you can leave it out (just like in the simpler statement we discussed
before).
If the field list for SourceTable happens to match * for that table,
you can replece it by "*".
Greetings,
Paul Vinkenoog
> I'm trying to copy all matching rows, but the statement I'm usingNo, there's no problem with the number of rows, but with the number of
> causes a compile-time error with the following message:
>
> An error was found in the application program input parameters
> for the SQL statement.
> Dynamic SQL Error.
> SQL error code = -804.
> Count of read-write columns does not equal count of values.
>
> Is this because ID is a foreign key and not unique in the table?
columns. It seems that the two tables don't have the same number of
columns. As such this is not a problem, but then you have to be more
specific in what you insert and/or select:
INSERT INTO TargetTable (Field1, Field2, Field3, ... )
SELECT ThisField, ThatField, TheOtherField, ... FROM SourceTable
WHERE ...
Number and type of the named fields must match, that is: ThisField
must be assignment-compatible with Field1, ThatField with Field2, etc.
If the field list for TargetTable happens to match * for that table,
you can leave it out (just like in the simpler statement we discussed
before).
If the field list for SourceTable happens to match * for that table,
you can replece it by "*".
Greetings,
Paul Vinkenoog