Wednesday, 15 June 2011

How insert a varchar ' / / ' as null on date column in PostgreSQL 9 -


I have a temporary table and want to insert data from another table, but temp In the date type, and column in usomultiple is a varchar .

If I try to convert using the to_date () function, I get an error because thousands of cells have been found to be '/ /' Was empty as the value.

ERROR: Price is not valid for an «/ A» «DDA»

  temporarily from INSERT (cd_id, ds_estado, Dt_date) Select um.cd_uso, um.ds_estado, to_date (um.dt_dateIn, 'dd / MM / yyyy') from our liberalities;   

How can I set the cell to poblated when the '/ /' and the correct value is set instead?

  TO_DATE (NULLIF (dt_dateIn, '//'), 'dd / MM / yyyy ')    

No comments:

Post a Comment