Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.04.28;
Скачать: CL | DM;

Вниз

Помогите в работе с курсорами MS SQL 7   Найти похожие ветки 

 
xxxCrazyManxxx ©   (2003-04-10 19:00) [0]

Сам запрос выглядит так:
DECLARE product_curs CURSOR
SCROLL
FOR SELECT Product.Article
FROM Journal INNER JOIN Document ON Journal.Document = Document.Document
INNER JOIN Address ON Document.Debitor = Address.Address
INNER JOIN Product ON Journal.Product = Product.Product
INNER JOIN Shift ON Document.Shift = Shift.Shift
INNER JOIN Operation ON Document.Operation = Operation.Operation
INNER JOIN GroupTax ON Journal.GroupTax = GroupTax.GroupTax
WHERE Address.AddressName = "АСПЕКТ-Л ООО"
FOR READ ONLY

CREATE TABLE #t
(Par varchar(16),
Pnu varchar(16),
Ppu int)

DECLARE
@Par varchar(16),
@Pnu varchar(16),
@Ppu int

SET @Par = ""
SET @Pnu = ""
SET @Ppu = 1

OPEN product_curs

WHILE @Ppu < @@CURSOR_ROWS

BEGIN
IF @Par <> @Pnu
FETCH product_curs INTO @Par
INSERT INTO #t (Pa) VALUES (@Par)
SET @Pnu = @Par
FETCH NEXT FROM product_curs
ELSE
FETCH NEXT FROM product_curs
END

SELECT * FROM #t

DROP TABLE #t

CLOSE product_curs

DEALLOCATE product_curs

Ругается на ELSE (Incorrect syntax near the keyword "ELSE".)
помогите , немогу разобраться.

Заранее благодарен!!!


 
Zelius ©   (2003-04-10 20:30) [1]

Может в этом дело?
IF @Par <> @Pnu
BEGIN -- <<<
FETCH product_curs INTO @Par
INSERT INTO #t (Pa) VALUES (@Par)
SET @Pnu = @Par
FETCH NEXT FROM product_curs
END -- <<<
ELSE
FETCH NEXT FROM product_curs
END


 
Zz_   (2003-04-10 20:53) [2]

FETCH product_curs INTO @Par
...
FETCH NEXT FROM product_curs


 
xxxCrazyManxxx ©   (2003-04-10 21:07) [3]

Спасибо!!!!!!!!!



Страницы: 1 вся ветка

Текущий архив: 2003.04.28;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.014 c
3-91229
Sherbacov
2003-04-09 17:54
2003.04.28
Что за Ошибка


7-91575
_GOG_
2003-03-07 06:36
2003.04.28
TShellListView


14-91480
me2
2003-04-10 09:41
2003.04.28
DirectX 9 SDK


4-91584
Diamond Cat
2003-02-28 03:45
2003.04.28
Ресурсы


7-91577
Ifrit
2003-03-09 13:37
2003.04.28
Народ, помогите!!! Как определить установлен ли Word в системе?