I should add, I think this will work IF you are using all the columns in the
target table... if not, you must specify the target columns as well:
INSERT +
INTO problemtables (Col1, Col2, Col3, Col4, Col5, Col6) +
SELECT tablename, newcount ,oldcount,.#DATE,.#TIME, .vdbold +
FROM tablecompare +
WHERE oldcount <> newcount OR newcount IS NULL
I use this syntax habitually so mods to the target table don't screw up my
routine.
Ben Petersen
On 19 Jun 2003, at 15:01, Ben Petersen wrote:
> Sorry, should have been:
>
> INSERT +
> INTO problemtables +
> SELECT tablename, newcount ,oldcount,.#DATE,.#TIME, .vdbold +
> FROM tablecompare +
> WHERE oldcount <> newcount OR newcount IS NULL
>
>
>
>
>
> On 19 Jun 2003, at 16:22, Jim Limburg wrote:
>
> > Ben
> >
> > This gives me an error of Invalid Syntax..
> > INSERT +
> > INTO problemtables tablename, newcount ,oldcount,.#DATE,.#TIME, .vdbold +
> > FROM tablecompare WHERE oldcount <> newcount OR newcount IS NULL
> >
> > Jim limburg
> >
> > Ben Petersen wrote:
> > > INSERT INTO problemtables Col1, Col2, Col3, .#DATE,.#TIME, .vdbold +
> > > FROM tablecompare +
> > > WHERE oldcount <> newcount OR newcount IS NULL
> > >
> > >
> > > On 19 Jun 2003, at 16:00, Jim Limburg wrote:
> > >
> > >
> > >>G-Day
> > >>
> > >>OK, I don't think I'm far off, but I have a table in want to insert into
> > >>values from another table along with some static info..
> > >>
> > >>Here is the statement I'm using..
> > >>
> > >> INSERT INTO problemtables SELECT * FROM tablecompare +
> > >> WHERE oldcount <> newcount OR newcount IS NULL +
> > >> UNION SELECT (.#DATE,.#TIME, .vdbold) FROM dummy
> > >>
> > >>The table is created like this
> > >>CREATE TABLE problemtables (tablename TEXT (18), newcount INTEGER,oldcount +
> > >> INTEGER, tmstampdt date, tmstamptm time, dbname TEXT (18))
> > >>
> > >>Dummy is by
> > >>CREATE TABLE dummy (x TEXT (1))
> > >>INSERT INTO dummy x VALUES ('x')
> > >>
> > >>vdbold is populated..
> > >>
> > >>I'm figuring the select fills the first three columns, and the union fills
> > >>the rest, but I keep getting the error 2148 - Expression contains extra
> > >>comma
> > >>
> > >>What am I doing wrong here?
> > >>Jim Limburg
> > >>
> > >
> > >
> > >
> >
>