Hi James, Nathan I found the problem. Nathan was right. The table was lacking a field with data type "int", which is unique. I had a field with data type "text" which was unique. That is obviously not sufficient.
Thanks for your help! Peter -----Ursprüngliche Nachricht----- Von: James Wood [mailto:[email protected]] Gesendet: Dienstag, 5. Mai 2015 12:44 An: Peter Schürch Betreff: Re: AW: [Qgis-user] Add mssql non-geometric tables Peter, I am also running 2014. It's a good question to ask, and honestly I'm not sure what the specifics are for a recognizable table in QGIS. Do you want to send me a dump of the table and let me try it over here? James Sent from my iPhone > On May 4, 2015, at 00:31, Peter Schürch <[email protected]> wrote: > > Hi James > Unfortunately the error message is a lot less specific as I thought... QGIS > complains (in german, sorry) that the layer is invalid... > > > Layer ist ungültig: Der Layer dbname='geosfer' host=meiwes03 > estimatedmetadata=true srid=0 table="dbo"."Borehole_Kind" sql= ist ungültig > und kann der Karte nicht hinzugefügt werden > > This brings me back to the original question: what makes a flat table valid > for QGIS? Is there any meta information needed somewhere? > Hopefully you can make some sense of this. > > Cheers, Peter > > Von: James Wood [mailto:[email protected]] > Gesendet: Samstag, 2. Mai 2015 16:22 > An: Peter Schürch > Betreff: Re: [Qgis-user] Add mssql non-geometric tables > > Hey Peter, > Yes, the problem is a little clearer now, thanks. When adding what we refer > to here as a "flat table" (i.e., no geometry), it always just adds as a table > object, so I've never seen that error before. The exact error message would > be helpful. Also, what version of SQL Server are you running? > > James > Sent from my iPhone > > On May 2, 2015, at 04:01, Peter Schürch <[email protected]> wrote: > Hi James > Thanks for getting back to me. > I'using Wien too. > The database connection is established. I can add existing geometry layers > from the DB to the qgis project. I can also add new layers to the DB (e.g. A > shape). So no fundamental problem with the DB. > > My problem is the following. > I have defined a table in the DB without geometries, just numeric data. I can > see it in the qgis browser but when i try to add it to my project i get an > error saying that it is missing a crs. So i guess there is some meta info > missing somewhere, but i wonder where and whether it has something to do with > the metadata table 'geometry_colums' required for spatial layers. I need to > look up the exact error message when I'm back in the office. > > Hope this is a little clearer now :-) > Regards. > Peter > -- > Meier und Partner AG > Freiestrasse 26 > 8570 Weinfelden > www.meierpartner.ch > T +41 71 626 5115 > > Am 01.05.2015 um 02:34 schrieb "James Wood" <[email protected]>: > Hey Peter. Did you get a response to your question? I may not be > understanding exactly what you are trying to do, but if you go ahead and add > your MSSQL instance and connect to the database, you will be presented with > both spatial and non -spatial tables that you can add into the map. > > So, (not to patronize), if you go to Layer > Add Layer > Add MSSQL Spatial > Layer, that will present a dialog where you can choose your instance from the > drop down or create a new connection. The list of all available table objects > will appear once you hit connect. I'm using 2.8 Wien. > > HTH and I haven't missed your question entirely. > > James > Sent from my iPhone > > On Apr 30, 2015, at 13:55, Peter Schürch <[email protected]> wrote: > Hi > Does anybody know how to add a non-geometric table from an mssql database to > a qgis project? > Do I need to add it in the table "geometry_columns"? If yes what would be the > appropriate attribute values there? > Thanks > Peter Schürch > -- > Meier und Partner AG > Freiestrasse 26 > 8570 Weinfelden > www.meierpartner.ch > T +41 71 626 5115 > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
