Questions tagged [sql-server]

Microsoft SQL Server is a relational database server product by Microsoft. Its primary query languages are T-SQL and ANSI SQL.

243 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
4k views

When does WKT orientation matter for polygon and multipolygon in geography spatial (left/right hand rule, counter-clockwise, clockwise)

I've decide to use sql server on Azure for my gis database. I'll be dealing with spatial Geography not Geometry. While inserting some country boundaries using the spatial data in SQL Server, some ...
Luther's user avatar
  • 221
6 votes
0 answers
310 views

Spatial Precision for Editing in Multiple GIS Clients

I have something I'd like to discuss, I'll try to explain it first, why it's important, and I'll explain how ArcGIS handles the issue, which I think is a good way to handle it. Finally I'd like to ...
Alex Leith's user avatar
  • 13.4k
4 votes
1 answer
184 views

MSSQL STIntersection Results in COMException

Using MS SQL Server 2019 and running the following query results in the COMException displayed below. DECLARE @Geom1 AS GEOMETRY DECLARE @Geom2 AS GEOMETRY SET @Geom1 = ...
CarteTon's user avatar
  • 116
4 votes
0 answers
934 views

QGIS Convert Shapefile to MSSQL as geography type

I am using QGIS 3.16 and SQL Server 2019. I have a shapefile loaded into the project. I have been able to successfully convert the Shapefile to a spatial dataset in SQL Server. My method for doing ...
William Powell's user avatar
4 votes
2 answers
2k views

Combining ST Buffer and Intersect with Where clause

I'm trying to create a buffer around a single point in a spatial entity and finding all the points from a different entity that fall within that buffer. I tried two approaches. The code below runs ...
rzelayac's user avatar
4 votes
0 answers
384 views

QGIS 2.10.1 & SQL Server 2014

I'm struggling to load spatial data into QGIS from SQL Server 2014. I have a table with 4 geography columns (3 are polygon layers, one is a point layer). The table has a primary key column that is a ...
WV_Mapper's user avatar
  • 161
4 votes
0 answers
374 views

SQL Server, Given a linestring with M value, what is the location of this other M value

We are investigating migrating a prototype into SQL Server (azure). We have LineStrings that also have M values. What we would like to do is given another M value find out what its geographical ...
Techlead's user avatar
4 votes
0 answers
198 views

New SQL Monitor Showing Database Deadlocks, Should I be alarmed?

We recently installed a SQL Monitoring tool that is raising High Alerts for SQL Server Deadlocks on my SDE database at random times during the day. Using the information provided in the Alert I have ...
Jeff T.'s user avatar
  • 41
4 votes
0 answers
1k views

Geoserver WMST Date Format

There is table in SQL-Server 2008 R2. In this table I have date column with date format like this 2006-09-08 14:39:41.000. Now I make a view from this table on GeoServer side and do nothing with the ...
Kliver Max's user avatar
  • 2,032
4 votes
0 answers
2k views

Ogr2ogr: Unable to open datasource problem

I downloaded the Precints shapefile from the City of Boston's data hub, and I'm trying import it into SQLServer (I'm running the Express verson). I've already created the database in the SQLServer (...
Dan's user avatar
  • 41
4 votes
0 answers
1k views

How to get WKT from SHAPE column in the ArcSDE geodatabase?

I have an ArcSDE geodatabase running on top of SQL Server 2008. A table for a feature layer was added from ArcCatalog. The SHAPE column is a type of int which was automatically converted from ...
alextc's user avatar
  • 2,013
3 votes
0 answers
161 views

QGIS has started putting all features into one row in Attribute Table

This is a bit of an odd one. We host our data in an Microsoft SQL Server database, and until a couple of weeks ago this was working fine. We've got about 17000 rows in it, all with a geometry. When I ...
user25730's user avatar
  • 884
3 votes
0 answers
286 views

Efficient way to "gridify" SQLGeography shape

Read the "Background" below for full details of why I want to achieve this. Given a shape, I would like to process it in such a way that it conforms to a 0.00001 x 0.00001 degree grid. (This ...
Tim.E's user avatar
  • 31
3 votes
1 answer
353 views

Optimising Large Spatial Queries in SQL

I'm sure similar answers have been given elsewhere but no matter what I have tried I am unable to optimise this query. Details: TableA has 3.5mill records TableB Had 57000 records but I have ...
Jay Edwards's user avatar
3 votes
0 answers
223 views

Using SQL intersect query?

I am trying to find the length of a polyline inside a polygon using this query: DECLARE @p geometry, @l geometry; SELECT @l = SHAPE FROM [Vz_DSM_Stationing].[dbo].[Route_Sections] WHERE OBJECTID = 3; ...
T Kelly's user avatar
  • 31
3 votes
0 answers
61 views

Loading layer from ArcSDE for SQL Server Database using PyQGIS?

I am use this code to load a layer from ArcSDE SQL Server database, but it only loads a table. uri = QgsDataSourceURI() uri.setConnection("localhost","", "arcsde", "sa", "****") uri.setDataSource('...
zuotianhui's user avatar
3 votes
0 answers
109 views

Rename the output file ArcGIS

I am copying a tons of features from a file geodatabase to a database server. First I created an enterprise geodatabase connenction and after a database connection. In the first step I added a ...
mean1432's user avatar
3 votes
0 answers
414 views

Problem with adding non spatial view from MSSQL to QGIS

I have QGIS 2.12.3 app installed on one server (servername1) and MSSQL server database installed on servername2. The database is password protected and I have made connection successfully using QGIS ...
Annetic's user avatar
  • 31
3 votes
0 answers
370 views

GDAL MSSQL with numeric table names

I have many SHP tables organised by year, for example 2015_xx_data.shp that I have loaded into a MS SQL Server database using OGR2OGR. I have also loaded them into MySQL for a comparison. There are no ...
Jason Agronaut's user avatar
3 votes
0 answers
849 views

qgis unable to connect to ms sql server using sql authentication

I am getting the following error when I try to set up a connection to a MS SQL Server database using sql server authentication. I did find a bug report from 2014, but that was apparently fixed and ...
joleady's user avatar
  • 31
3 votes
0 answers
51 views

Shoehorning hierarchial data into ArcSDE for MS SQL Server?

I've been tasked with creating a set of tables to store hierarchical data within an ArcSDE. This is in reference to utility data, i.e, a set of valves, control panels, actuators, etc (each ...
ChronoSphere's user avatar
3 votes
0 answers
377 views

Refreshing MSSQL Layer in QGIS

When working on a map in QGIS I will often set up a view in my SQL Server spatial database and create a MSSQL layer based on this. As part of my workflow I often make adjustments to the SQL view ...
Tumbledown's user avatar
  • 1,683
3 votes
0 answers
784 views

ArcGIS 10.1 & SQL Server 2012

We currently updated to SQL Server 2012 and now we are encountering a slower performance when connecting to the geodatabase on SQL Server 2012. Here are the things that we tried to fix the issue: - ...
Juno's user avatar
  • 415
3 votes
0 answers
2k views

Use MS SQL Server to convert MGRS to Lat Long

Below is the SQL for converting Military Grid Reference System (MGRS) to decimal Latitude and Longitude. It is very accurate, but not perfect. If you can make it work 100%, it is yours, but PLEASE ...
Nate's user avatar
  • 31
2 votes
0 answers
37 views

How do I find the length of part of a line segment that crosses a polygon boundary?

I have a street centerline table and a borough boundary polygon table. I want to select any centerlines that cross borough boundaries and also return the how much of that centerline is crossing each ...
Kurt Cederholm's user avatar
2 votes
0 answers
253 views

Cannot add geometry layer to QGIS although geometry column is recognized

The geometry column POINT in the View (not Table) View_MyGeometry is generated in the SQL database GeoData with Microsoft SQL Server Management Studio. QGIS recognizes this column as a geometry column ...
stonebe's user avatar
  • 445
2 votes
0 answers
208 views

Passing parameters from QGIS to a SQL Server stored procedure and link this as new layer?

I'm new to QGIS and may not have understood the principle properly yet. I'm coming from database development. Question: I have a stored procedure in SQL Server that uses a date range as a parameter. ...
Karsten's user avatar
  • 21
2 votes
0 answers
149 views

Running ogr2ogr script batchfile from SQL fails due to temporary drive mapping

I am trying to run the SQL procedure EXEC xp_CMDShell 'blahblah.bat' which needs to run an ogr2ogr script to create a kml from sql. The batch file works if I run it alone but with SQL permissions it ...
Joshua J Geoghegan's user avatar
2 votes
0 answers
60 views

arcpy.ArcSDESQLExecute with UPDATE and OUTPUT

Is there a way to get OUTPUT through arcpy.ArcSDESQLExecute? Whatever I do I get only True. When running UPDATE through MS SQL Server Management Studio I get OBJECTID of all updated features (rows): ...
Miro's user avatar
  • 9,714
2 votes
0 answers
404 views

T-SQL Invalid Geometry Created by Intersection

I have two sets of geometries (A and B) in SQL Server 2016. I want to determine the overlap areas of those geometries from set A that intersect set B. Most of the time this code works: SELECT a....
AJSmyth's user avatar
  • 383
2 votes
0 answers
351 views

Use PYQGIS to view MS SQL Server temporary table in QGIS

I'm working on a QGIS plugin to query a non spatial database held in MS SQL Server and to display the results of the query as a non spatial table in QGIS. I've tried the following: create global ...
ian's user avatar
  • 1,713
2 votes
0 answers
2k views

From ESRI:103300 to EPSG:4326 in SQL Server

This question is more or less a sequel to Performance of joining tables on a geometry column with SQL Server As explained in the above link, I have a shapefile that I upload to my SQL Server DB using ...
Guillaume's user avatar
2 votes
0 answers
347 views

SQL geography::EnvelopeAggregate output not accurate

I am trying to get the geography::EnvelopeAggregate for a set of locations. The geography column values are calculated using the Lat/Long for individual points. When I try to fetch the boundary box(...
ckv's user avatar
  • 121
2 votes
0 answers
105 views

QGIS2.14: Attribute table values show "error" while Identify show results

Using QGIS2.14 and using source data from a MSSQL Server 2016 instance I stumbled across a strange error. My attribute table show all values as "ERROR"-values while using Identify shows up attribute ...
Steven De Vriendt's user avatar
2 votes
0 answers
1k views

SQL Server 2014 Failure to access the DBMS server 08S01

After upgrading our esri sde database from SQL Server 2008 to 2014 I am experiencing issues when overwriting some of our larger datasets. After some amount of time the overwriting process abruptly ...
mdown's user avatar
  • 45
2 votes
0 answers
171 views

MS SQL Layer - Losing LineStrings (Polyline) from SQL Server to QGIS

I have a table called [gfts].[Shapes] which contains a primary key shape_id and a geography data type GEOM. When I query the table in SQL Server I get the following Spatial Results: However, when I ...
Xavier's user avatar
  • 173
2 votes
0 answers
274 views

point in multiple polygons

I have a point (lat/lng) and a collection of geofences (polygons / circles / rectangles) Simply put, I want to know if the point is inside ANY of the geofences, it's not important which one. I know ...
NickPR's user avatar
  • 143
2 votes
0 answers
654 views

ERROR 1: Error initializing the metadata tables :

I use ogr2ogr (bundled with QGIS 2.14.3) on Windows to convert an ArcSDE MS SQL Server 2012 database with SQL Geometry to PostGIS (2.1.8). I use the following syntax: ogr2ogr --config ...
Benedek Simo's user avatar
2 votes
0 answers
1k views

Export SQL Server to Shapefile with OGR, difference between 2014 and 2012

I'm trying to export some data from a SQL Server table to a shapefile. I have tested this on a 2014 SQL Sever and it works but when I try and run it on a 2012 SQL Server it creates a blank output. ...
user19466's user avatar
  • 111
2 votes
0 answers
156 views

Improve performance of a stand-alone table join in a Feature Service

I have an mxd with data-driven pages using Feature Layers from ArcGIS for Server (Workgroup Standard) with MS SQL Server Express. The DDP index layer has a join to a stand-alone table. I am ...
Aaron's user avatar
  • 89
2 votes
0 answers
387 views

Connecting QGIS 2.14.3 to SQL 2012 both on LocalHost or Remote

I am working on establishing MSSQL (2012) spatial connection from my QGIS 2.14.3, its giving me an error like: (Error opening connection: [Microsoft][SQL Server Native Client 11.0]Named Pipes ...
Oluwafemi Ooju's user avatar
2 votes
0 answers
113 views

Asp.net or MsSql Create bbox of a point proportional to image height and width

Short question is how do I create bbox dimensions that is proportional to image height and width? I'm working on a asp.net webservice to generate a map using geoserver. The parameters I have are ...
Kathy Judd's user avatar
2 votes
0 answers
492 views

How to properly deal with rectangles being curved on geographies?

I'm using Microsoft SQL Server to store simple data for administrative boundaries of the world (lots of polygons). I store this in a geography data type column. Afterwards I query these polygons by a ...
Vilx-'s user avatar
  • 194
2 votes
0 answers
659 views

Best SRID for worldwide data in Microsoft Sql Server geometry field?

I'm using Microsoft Sql Server 2012 to store geographical data related to hydrometeorological stations which are scattered around the globe (point layers and multipolygon layers). My data is in WGS84 ...
Nicola Tramarin's user avatar
2 votes
0 answers
1k views

QGIS Connection with MSSQL localdb not possible correctly

I installed MSSql Server Express with localDB. Everything looks ok. The connection with the LocalDB is nessesary and the tables and views are displayed in the QGIS MSSQL Dioalog. A primary key is ...
Gerd's user avatar
  • 21
2 votes
0 answers
117 views

SQL server in ArcGIS 10.2 Desktop

I am using ArcGIS 10.2, and previously using Oracle spatial as back end. Now the data providers have shifted to SQL providing core data using FTP which is being staged at SQL server. We need to ...
GurminderS's user avatar
2 votes
0 answers
620 views

Is there a way to eliminate duplicate 'point clusters' in SQL Server 2008 r2 spatial?

I am using the ST.Distance function to identify clusters of geometry data points. Each point has a unique reference number associated with it. I would like to eliminate duplicate clusters from the ...
Somanyquestions's user avatar
2 votes
0 answers
1k views

How to populate the geometry_columns table

I have a SQL Server table of vector data (containing latitude, longitude, UComp and VComp columns), that I am trying to add as a layer to QGIS. Here is a sample of the data in the SQL Server data ...
Reg's user avatar
  • 21
2 votes
0 answers
930 views

Import GML data in SQL Server Spatial

I have GML file with Application Schema whose data I need to import into SQL Server Spatial. I have been creted database structure with all thing that I need in database, and now I need to fill it ...
Aleksandar's user avatar
2 votes
0 answers
238 views

Convert Arcpy results to feature class in ArcMap 10.1

I am using ArcGIS 10.1 and am a newbie in Python. Currently we are executing stored procedure (from sql server) through ArcPy in ArcMap. I want to create feature class from executing following python ...
Sunil's user avatar
  • 4,753

1
2 3 4 5