Forum Discussion

MLingo's avatar
MLingo
Frequent Visitor
4 months ago
Solved

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:

select geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0)
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)

 

  • 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

Replies have been turned off for this discussion
  • v-tejrama's avatar
    v-tejrama
    Community 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.

    • v-tejrama's avatar
      v-tejrama
      Community Support

      Hi sukkaur ,

       

      I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

      Thank you.

  • sukkaur's avatar
    sukkaur
    Microsoft Employee

    MLingo  - I just tried this code in my SQL database in Fabric and it does work. Can you please try again and let me know if you still having the issue? Please do share which region is your tenant in.

    thanks

    Sukhwant

    • MLingo's avatar
      MLingo
      Frequent 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)

      • sukkaur's avatar
        sukkaur
        Microsoft Employee

        MLingo - Can you please create a support case? Feel free to drop the support case number here and I will keep an eye on it.

         

        Thanks

        Sukhwant

    • MLingo's avatar
      MLingo
      Frequent 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

      1. Use recursive cte (must be SQL DB) using the  geometry::STGeomFromText() funtion which is the error in this thread
      2. 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().
      • lbendlin's avatar
        lbendlin
        Super User

        In US West region the query runs fine against the SQL Database but not against its SQL Analytics Endpoint.