您可以强制转换为VARBINARY(MAX),然后重新强制转换。
create table tbl1 ( ID int, a int, b char(3), d geometry );create table tbl2 ( ID int, a int, b char(3), d geometry, other float );insert tbl1 (ID, a, b, d) values (1, 2, 3, geometry::STGeomFromText('POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0))', 0)), (2, 3, 3, geometry::STGeomFromText('POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0))', 0)), (3, 4, 3, geometry::STGeomFromText('POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0))', 0)), (4, 2, 3, geometry::STGeomFromText('POLYGON ((0 0, 250 0, 150 150, 0 150, 0 0))', 0)), (5, 2, 3, geometry::STGeomFromText('POLYGON ((0 0, 350 0, 150 150, 0 150, 0 0))', 0))insert tbl2 (ID, a, b, d) values (6, 2, 3, geometry::STGeomFromText('POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0))', 0)), -- same as tbl1.ID=1 (7, 2, 3, geometry::STGeomFromText('POLYGON ((0 0, 950 0, 150 150, 0 150, 0 0))', 0)), (8, 2, 3, geometry::STGeomFromText('POLYGON ((0 0, 350 0, 150 150, 0 150, 0 0))', 0)); -- same as tbl1.ID=5SELECt A, B, cast(c as geometry) cFROM( Select A,B,cast(D as varbinary(max)) c FROM tbl1 UNIOn SELECt A,B,cast(D as varbinary(max)) FROM tbl2) X;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)