Actually My proble is
DECLARE @SNO INT
DECLARE CURS_FOR_SNO CURSOR FOR SELECT * FROM MACB where cntrl_no='DC000429' and isnull(listed,'')='U' AND ISNULL(SNO,'')='' ORDER BY SNO
OPEN CURS_FOR_SNO
FETCH NEXT FROM CURS_FOR_SNO
WHILE @@FETCH_STATUS = 0
BEGIN
SET @I=@I + 1
SET @SNO=@X + @I
UPDATE MACB SET SNO=@SNO where CURRENT OF CURS_FOR_SNO
FETCH NEXT FROM CURS_FOR_SNO
END
CLOSE CURS_FOR_SNO
DEALLOCATE CURS_FOR_SNO
it gives read only column but i want to update that so plz, solve my problem

cursor problem
MessDev
HTH, Jens Suessmeyer.
---
http://www.sqlserver2005.de
---
ashish tiwari
Jimmy Xiong
Hi,
you have defined a "Order by" which declares the cursor as readonly. Leave the Orderby and put a FOR UPDATE after your cursor declaration:
DECLARE CURS_FOR_SNO CURSOR FOR SELECT * FROM MACB where cntrl_no='DC000429' and isnull(listed,'')='U' AND ISNULL(SNO,'')='' FOR UPDATE
HTH, Jens Suessmeyer.
---
http://www.sqlserver2005.de
---
Bill Barnett - MS
DRAYKKO
HTH; Jens Suessmeyer.
---
http://www.sqlserver2005.de
---