如何去除CURSOR里LAST后面的空记录行??
如下: 结果集中有6 条记录执行之后,窗口中除6条记录外,还有第 7 条空记录(只显示字段)
该如何去除这个LAST后面的空记录显示?
谢谢
(想着用@@CURSOR_ROWS和FOR做,就是做不出来,偶SQL新人,,请教!!!)
USE TEST
GO
IF EXISTS (SELECT name FROM sysobjects Where name='customers_proc')
DROP PROCEDURE customers_proc
GO
CREATE PROCEDURE customers_proc
AS
DECLARE customers_cur scroll CURSOR FOR SELECT * From customers
OPEN customers_cur
FETCH NEXT FROM customers_cur
WHILE @@FETCH_STATUS=0
BEGIN FETCH NEXT FROM customers_cur
END
CLOSE customers_cur
DEALLOCATE customers_cur
GO
EXECUTE customers_proc
GO