Ďakujem za radu,trochu som to upravil, neviem či je to " košer ", ale robí to čo potrebujem.
declare @MAXID decimal(18,0)
select @MAXID = max(ID) from SURADNICE group by ID order by ID
declare @VAR int
set @VAR = 1
WHILE @VAR <= @MAXID
BEGIN
declare @ID decimal(18,0)
declare @POLY varchar(max) = 'POLYGON(('
select @ID=ID, @POLY = (@POLY + cast(Y as varchar(50)) + ' ' + cast(X as varchar(50)) + ',') from SURADNICE where ID = @VAR
set @POLY = SUBSTRING(@poly, 0 , len(@poly)) + '))'
select @ID, @POLY
set @VAR += 1
END
|