none
Help How do conditioning importing data from a CSV file If field "A" value empty Take > value from field "B" AND IF field "A" and field "B" is empty Take from value from Field "C"

    Question

  • Help How do conditioning importing data from a CSV file
    If field "A" value empty Take > value from field "B" AND IF field "A" and field "B" is empty Take from value from Field "C"
    *And finally create a new TXT file with result

    TNX
    Wednesday, August 10, 2016 7:29 AM

Answers

  • Hi ,

    You can use the coalesce function :

    select coalesce(A, B, C) as col

    from table

    http://www.1keydata.com/sql/sql-coalesce.html


    Regards, David .

    • Marked as answer by gpspocket Wednesday, August 10, 2016 12:49 PM
    Wednesday, August 10, 2016 10:10 AM

All replies

  • If you were do this in T-SQL, you would need to load the file into a staging table and take it from there.

    Wednesday, August 10, 2016 9:48 AM
  • OK
    But how to do it correctly in SQL ?
    If field "A" value empty Take > value from field "B" AND IF field "A" and field "B" is empty Take from value from Field "C"


    Thanks

    • Edited by gpspocket Wednesday, August 10, 2016 10:02 AM
    Wednesday, August 10, 2016 9:59 AM
  • Hi ,

    You can use the coalesce function :

    select coalesce(A, B, C) as col

    from table

    http://www.1keydata.com/sql/sql-coalesce.html


    Regards, David .

    • Marked as answer by gpspocket Wednesday, August 10, 2016 12:49 PM
    Wednesday, August 10, 2016 10:10 AM
  • TNX it work
    Wednesday, August 10, 2016 12:49 PM