Comments (6)
That's what the second parameter in the sample is doing -- passing in the text and creating the geography server-side. It returns the correct result for STIsValid, unlike passing in the geography, which returns an incorrect result. I assume there's a performance hit to convert the geography to text client-side and back to geography server-side.
from microsoft.sqlserver.types.
If you send in the text as a parameter (instead of as geography type) and convert to geography server-side do you get the same result?
from microsoft.sqlserver.types.
Some more information: It look like SQL Server's call to STIsValid returns whatever the geography object's internal _isValid is set to. If you create the geography in the sample client-side, the internal _isValid value is true. When you send the object up as a parameter and call STIsValid(), it returns true. But if you use reflection to set _isValid to false before sending the parameter, SQL returns false. SQL isn't recalculating isValid, but essentially trusting that the client set it correctly.
from microsoft.sqlserver.types.
MakeValid has a similar problem--SQL doesn't modifiy the geometry to make it valid if the internal _isValid is already true.
from microsoft.sqlserver.types.
Whaaaaat? That’s just ridiculous 🤦♂️🤦♂️🤦♂️
In that case I honestly don’t think there’s much I can do beyond actually implementing valid calculations which is not something I want to get into
from microsoft.sqlserver.types.
Here's a way to pass the geometry as a parameter and force the server to reevaluate isValid:
SELECT geography::STGeomFromWKB(@1.STAsBinary(), 4236).STIsValid()
Similarly, if you want MakeValid to work, it's
SELECT geography::STGeomFromWKB(@1.STAsBinary(), 4236).MakeValid()
Yuck, but it appears to work.
from microsoft.sqlserver.types.
Related Issues (20)
- ToString() of SqlHierarchyId does not return "NULL" when IsNull == true HOT 1
- GetDescendant for a simple range fails with a HierarchyIdException HOT 2
- Throw HierarchyIdException instead of ArgumentException in GetDescendant method
- HierarchyId serialized in an invalid format which can't be deserialized HOT 11
- Some Geography cannot be deserialized. HOT 4
- When using Microsoft.Data.SqlClient an InvalidCastException will be thrown HOT 3
- Could not load file or assembly Microsoft.SqlServer.Types HOT 13
- SqlHierarchyId Write/Read roundtrip causes data corruption HOT 9
- System.Data.SqlClient needs a version bumb from 4.5.1 to 4.8.3 HOT 4
- assembly load error HOT 4
- DataReader.GetFieldType returned null HOT 10
- MultiPoint issue? HOT 2
- Specified type is not registered on the target. HOT 1
- Referenced assembly 'Microsoft.SqlServer.Types, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name
- Fill DataTable throws DataReader.GetFieldType null
- Insert to SQL Server throws exception - `Specified type is not registered on the target server`. HOT 1
- Using Microsoft.Data.SqlClient 5.0.1 causes System.TypeLoadException: Could not load type 'Microsoft.Data.SqlClient.Server.IBinarySerialize' HOT 10
- Security Vulnerability: https://github.com/advisories/GHSA-8g2p-5pqh-5jmc HOT 7
- Upgrade from Framework to Standard HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft.sqlserver.types.