OK, pour la position, du coup j'ai voulu faire ma deuxième solution, j'arrive au curseur suivant :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| declare @idx_tot integer
declare @num_entite integer
declare @champ1 integer
declare @idx integer
declare @type varchar(50);
declare Cursor_geom cursor FOR
select id_z_ve, Geom_simpl.STNumGeometries() from Zone_VE
open Cursor_geom
fetch next FROM Cursor_geom INTO @num_entite, @champ1
while @@fetch_status = 0
begin
set @idx_tot = @champ1
set @idx = 1
while @idx <= 5--@idx_tot
begin
set @type = exec('select geom_simpl.STGeometryN('+@idx+').STGeometryType() from Zone_VE')
if @type <> 'Polygon'
if @type <> 'MultiPolygon'
exec('update Zone_VE set geom_simpl = geom_simpl.STDifference(select geom_simpl.STGeometryN('+@idx+')
from Zone_VE )
where id_z_ve = '+@num_entite+' ')
--print @idx
set @idx = @idx+1
end
fetch next FROM Cursor_geom INTO @num_entite,@champ1
end
close Cursor_geom
deallocate Cursor_geom |
Évidemment ce dernier ne fonctionne pas puisque la ligne suivante n'est pas correcte :
set @type = exec('select geom_simpl.STGeometryN('+@idx+').STGeometryType() from Zone_VE')
Je voudrais attribuer le résultat de la requête à la variable @type, comment puis-je faire ??...
Partager