I want to convert geometry to geography in SQL Server; I followed this article:
Here is my query:
INSERT INTO gCOMMUNE
SELECT
[dbo].[commune].[ogr_fid],
GEOGRAPHY::STGeomFromWKB(commune.ogr_geometry.STAsBinary(),4326)
FROM [IMMATS].[dbo].[commune]
but when I ran the command to convert I got this error:
Msg 213, Level 16, State 1, Line 26 The name or column number of the values provided does not match the definition of the table.
It looks like
gCOMMUNE
table has different number of columns than the query for selecting the data to be inserted in it. You must specify the column names in the INSERT INTO statement. Assuming there are columns namedid
andgeom
(from your clarification it turns out they are [ogr_fid] and [ogr_geog]), here is how your statement could look like: