FETCH NEXT FROM CHILD_ATTR_CURSOR INTO ATTR --Получаем список полей та

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
FETCH NEXT FROM CHILD_ATTR_CURSOR INTO @ATTR
--Получаем список полей таблицы
WHILE @@FETCH_STATUS = 0
BEGIN
IF (@ATTR_LIST <> '' AND @CHILD_ATTR_LIST <> '')
BEGIN
SET @ATTR_LIST = @ATTR_LIST + ', CHILD_CLASS_FROM.' + @ATTR
SET @CHILD_ATTR_LIST = @CHILD_ATTR_LIST + ', ' + @ATTR
END
ELSE
BEGIN
SET @ATTR_LIST = 'CHILD_CLASS_FROM.' + @ATTR
SET @CHILD_ATTR_LIST = @ATTR
END
FETCH NEXT FROM CHILD_ATTR_CURSOR INTO @ATTR
END
CLOSE CHILD_ATTR_CURSOR