SQL Server2008 表空间化
解决:[*]新建geometry类型字段,取名为geom
[*]更新现有属性数据到geom字段中,这里假设经纬度坐标存放字段分别为x,y类型都是numeric
update tablename set GEOM=geometry::STGeomFromText('POINT('+convert(varchar,x)+' '+convert(varchar,y)+')',4326) where x is not null and y is not null;
此处注意要将numeric类型用convert函数强制转换为varchar.
更新期间遭遇 数据库日志文件已满的错误,在此一并记录下来。
解决办法:
将数据库切换到 simple 恢复模式 alter database dbname set recovery simple
再将数据库切换回原来的恢复模式 alter database dbname set recovery full
[*]对geom字段创建空间索引
create spatial index idx_tablename_geom on tablename(geom) with (Bounding_Box=(xmin=-180,ymin=-90,xmax=180,ymax=90));
页:
[1]