I'll spare you the details, but I need to move an SDE Featureclass to SQL Spatial Type.
For various reasons I can't use Shape2SQL, nor a python script that I have to read/write geometries.
I need to move it using SSMS from my SDE DB to my plain ole regular SQL DB.
Found some stuff online that said the following should work, but I get the following error:
Msg 257, Level 16, State 3, Line 5
Implicit conversion from data type geometry to varbinary is not allowed. Use the CONVERT function to run this query.
declare @g varbinary(max);
set @g = 0x3200000001000000A6D0E5BEAA0681AFEFC0D713D4F705ECD5F30497E222BA049DB30597B1BB04B080B704ADEA018C3DA8F937DCDCD904FAC401;
declare @h geometry;
set @h = geometry::STGeomFromWKB(convert(geometry, @g), 3857)
select @h FEATURE_SHAPE
Or the same implementation on the table directly, acting upon the same geometry as above:
SELECT
geometry::STGeomFromWKB(convert(geometry, points), 3857) as FEATURE_SHAPE
FROM [SDE_WORK_GIS].[sde].[f216]
where fid = 1
Other methods result in errors indicating that the varbinary format is invalid.
Read/writing to datatype geometry using python results in the following geometry binary, completely different (kind of expect that since the datatypes are different):
0x110F0000010407000000AEB662F3667861C1091B9EE6B5464B418A8EE48E677861C10F0BB5CEB4454B41228E75FF637861C15AF5B9D2B4454B41637FD971637861C13EE8D9DC9E464B4153962162297861C152B81E9D9F464B419A999955297861C1D656EC87B6464B41AEB662F3667861C1091B9EE6B5464B4101000000020000000001000000FFFFFFFF0000000003
Recently back from the Dev Summit where numerous Product Engineers and the like said this could be done, and that SDE stores geometry in the same format as SQL ST.
Thoughts?
Thanks in advance.