Question

I'm trying to make a copy of a table with only distinct values, using the following syntax:

SELECT DISTINCT *
INTO :TAB_DISTINCT
FROM TAB_MAIN

But IB doesn't like the INTO line (builds a plan ok with that line commented) Invalid token. Dynamic SQL Error. SQL error code = -104. Token unknown - line 2, char -1. INTO.

I've tried with & without the colon, also with & without an empty pre-existing TAB_DISTINCT with fields set up. but no cigar.

Anyone have any clues what dumbass syntax error i'm making here? many thanks, Brian

Was it helpful?

Solution

You can make a copy of a table with following statement:

  INSERT INTO copy_table (field1, field2, ... fieldn)
  SELECT DISTINCT field1, field2, ... fieldn
  FROM source_table  
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top