Search code examples
sqlsqlitespatialite

SQL apply a function to all data in a column


I am new to SQL. I am working on Spatialite which is a spatial database build on top of SQLite. I want to apply the function LineStringFromText() to all data in a column called "geometry". I tried the SQL statement below, but I get synax erors:

SQL error:"Near" "Select" Synax Error"

UPDATE test1f
SET geometry = SELECT LineStringFromText(geometry) from test1f

Solution

  • You over-engineered it. Change this:

    SET geometry = SELECT LineStringFromText(geometry) from test1f
    

    to this

    SET geometry = LineStringFromText(geometry)