I am currently working on a project in which spatial data are stored in a Microsoft SQL Server 2008 database. The tables which hold the spatial table contain 3 rows and are:
RoomId - BIGINT,
Description - VARCHAR(40),
Geometry - geometry.
I use QuantimGIS 1.8.0 for Windows and I use the tool for adding an MSSQL Spatial Layer. I succeed in connecting to the Server and I get a list of the tables which is as follows:
Schema: dbo
Table: tbl_lv1
Type: Polygon
Column: Geometry
SRID: 0
Primary key column: (empty)
Select at id: checked
Sql: (empty)
And when I click add, I get the following error:
dbname='gis' host='CAPDEV' user='qgisuser' password='*********' srid=0 type=POLYGON table="dbo"."tbl_lv1"(Geometry) sql= is an invalid layer and cannot be loaded
Why is this happening? Am I missing something?
Thank you
Solved: The solution was to add an auto-increment identifier to use as a primary key, because QuantumGIS needs a primary key attribute in order to import data.