Search code examples
datetimeloadsap-iq

Sybase iq cannot load table with datetime column


I'm trying to load table to a sybase iq database from a text file, and have a trouble loading datetime field... Always get error data type conversion is not possible. I tried a lot of ways in solving it...

  • creating varchar field and converting it to data
  • creating temp table and inserting values into my table from temp table using dateformat, cast, convert,
  • load table table_name( datetime_column datetime('dd-mm-yyyy hh-mm-ss') ) from ...

Nothing helps. Any help? thanks.


Solution

  • So I found the solution

    load table table_name (
        temp_date         ' | ',
      --  dt               datetime column 
    )
    from file_name
    
    ---------------------------------------
    set dateformat dmy;
    update table_name set dt = temp_date          
    
    ALTER TABLE table_name 
    DROP temp_date