Forum Discussion
SQL DB Error with geometry::STGeomFromText
Has anyone else run into an error using geometric functions in SQL Database in Fabric? Are thses functions not yet available in Fabric SQL DB? The STGeomFromText (geometry Data Type) article indicates the function should be available (the Applies to tag includes SQL Database in Microsoft Fabric).
The following statement (from the linked article) runs in Fabric Warehouse without error, but when run in SQL DB in Fabric, it gives the error below.
Statement:
When I created the ticket on Friday, it didn't run in the SQL Database or SQL Analytics Endpoint, but it did work in Fabric Warehouse (I tried that statement in all). I will close this out as solved now that it is working in SQL Database.
10 Replies
- v-tejramaCommunity Support
Hi MLingo ,
The behavior you are experiencing is expected with Microsoft Fabric SQL Database. Spatial and geometric functions, such as STGeomFromText, rely on Microsoft.SqlServer.Types components, which are not currently available in the Fabric SQL Database environment. Consequently, queries using these functions will succeed in Fabric Warehouse but encounter assembly loading errors in SQL Database.
While documentation may indicate SQL Database in Fabric as applicable, feature support is not yet consistent across all Fabric platforms. Currently, spatial data types like geometry and their associated methods are supported only in Fabric Warehouse, not in SQL Database.
Your query is correct; the limitation is due to the platform. If spatial operations are required for your workload, it is recommended to run these queries in Fabric Warehouse or handle spatial processing outside SQL Database until support becomes available in a future update.
Thank you. - MLingoFrequent Visitor
I just tried that line again and it still doesn't work. My tenant is in East US.
I still get the same error...
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
- MLingoFrequent Visitor
For what it's worth... I'm converting PostgreSQL query to Fabric and I have two ways to solve the problem I'm working on
- Use recursive cte (must be SQL DB) using the geometry::STGeomFromText() funtion which is the error in this thread
- My preferred method is to use Fabric Warehouse and the geometry::UnionAggregate() funtion, but it returns "Invalid Plan" for any query except the most basic (meaning WKT Linestring hard coded in CTE). If I save the same simple data to a table and try to run, I get "Invalid Plan". My query is more complicated, but I was willing to save to a table to continue processing using the geometry::UnionAggregate().
- lbendlinSuper User
In US West region the query runs fine against the SQL Database but not against its SQL Analytics Endpoint.