Loading CSV files
Loading OS NGD CSV files into databases
COPY destination_schema.destination_table
FROM 'source_path_to_csv_file\source_name_of_csv_file.csv'
DELIMITER ','
CSV HEADER
ENCODING 'UTF8';BULK INSERT destination_schema.destination_table
FROM 'source_path_to_csv_file\source_name_of_csv_file.csv'
WITH (
FORMAT = 'CSV',
FIRSTROW = 2
);-- Add new geometry column
ALTER TABLE destination_schema.destination_table
ADD new_geometry_column_name geometry;
-- Set new geometry column using existing WKT column
UPDATE destination_schema.destination_table
SET [new_geometry_column_name] = geometry::STGeomFromText(destination_table.geometry, /* EPSG_CODE_OF_GEOM */);
-- Optional drop original WKT column
ALTER TABLE destination_schema.destination_table
DROP COLUMN geometry;Last updated
Was this helpful?