Hi,
Using QGIS 2.4 with SQLSERVER 2008 R2.
I'm creating the following schemabound view:
CREATE VIEW myQGisView
WITH SCHEMABINDING
AS
SELECT d.seq_roteiro * 1000 + d.seq_descarga AS qgis_id,
d.seq_transmissao, d.seq_lote, d.seq_roteiro, d.seq_descarga,
a.val_numero_quadra, a.val_face_quadra,
b.seq_bairro, b.des_bairro, l.des_logradouro,
a.des_novo_logradouro, d.des_numero_imovel, d.des_complemento, d.des_cep,
GEOGRAPHY::STGeomFromText('POINT(' +
substring(a.des_coordenada_gps, charindex(',', a.des_coordenada_gps) + 1, 99) +
' ' + substring(a.des_coordenada_gps, 0, charindex(',', des_coordenada_gps))
+')', 4326) AS geo_localizacao
FROM t1 d
INNER JOIN t2 a ON d.seq_roteiro = a.seq_roteiro AND
d.seq_descarga = a.seq_descarga
INNER JOIN t3 l ON d.seq_logradouro = l.seq_logradouro
INNER JOIN t4 b ON b.seq_bairro = d.seq_bairro
WHERE d.seq_transmissao IS NOT NULL
GO
CREATE UNIQUE CLUSTERED INDEX IDX_VW_CADASTRO_QGIS ON myQGisView(qgis_id)
GO
The view and indexes are created, the calculation I did fo qgis_id will be
always unique.
QGIS has problems accepting it, error says "invalid layer and cannot be loaded."
and the dropbox for PK columns doesn't open up.
If I create a common view with this as first column in the select:
SELECT row_number() OVER(ORDER BY d.seq_lote, d.seq_transmissao, d.seq_roteiro,
d.seq_descarga) AS qgis_id,
QGIS accept the view and everything works, but selecting this view is very,
very slow.
Any ideias?
Thank you in advance,
Sergio
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user