I was trying to convert latitude and longitude columns which is in float type to geography type in SQL and then load them into Vertica table.
I used the following code to convert the columns into geography type:
CASE WHEN (Latitude IS NOT NULL AND Longitude IS NOT NULL)
THEN geography::Point(Latitude, Longitude, 4326)
ELSE NULL END AS Coordinates
But while trying to load the data from SQL to Vertica column which is in geography type, I get the following error:
ERROR: COPY: Input record 1 has been rejected (Row [1] rejected due to materialized type error on column: [Coordinates] with value: [POINT (-96.8922825 33.08097)].)
Is the geography type in SQL and Vertica different?
If so how can I convert it?
I would use the Vertica functions as you can find them in the docu.
For me, it worked like this:
You don't need a CASE WHEN expression. If one operand is NULL, the result is NULL, too. So just work with: