3

I'm a beginner SQL and GIS user and this my first time using stackexchange, so apologies if I'm asking the question properly. I'm trying to open some MSSQL tables in QGIS. I established a connection without any problems, but I am having trouble adding layers to QGIS. Some tables will be added properly, while others will not. I keep getting the error message The Layer dbName = 'x' host = x, estimatedmetada = true, srid = 0, table = "dbo"."practicetable". "practicetable" sql=is not a valid layerand can not be added to this map. I think the problem has something to with the lack of metadata. When I look at properties, I see a whole bunch of stuff in metadata for tables that work, while it only says error in metadata in tables that don't load.

Here's how the table I'm most interested in was created.

create table practicetable 
(name varchar(10),
longitude float(5),
latitude float(5),
srid varchar(50))
insert into practicetable
values('home' , 39.78, -86.14, 'EPSG:4326 - WGS 84')

When I cut and paste the output into a csv, I am able to add it as a delimited text layer without problems.

  • Make sure you create the table with a primary key column. – Nathan W Sep 25 '14 at 3:36
  • Thanks a lot. Declaring a primary key solved the problem. – Ravi Mehta Sep 25 '14 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.