我是编码方面的新手。我想知道是否可以选择MY_CURSOR
中的所有项目吗?
这是我所做的:
DECLARE @contractTypeFinalDependent1 VARCHAR(100)
DECLARE @contractTypeFinal1 VARCHAR(100)
DECLARE MY_CURSOR CURSOR LOCAL STATIC READ_ONLY FORWARD_ONLY FOR
SELECT *
FROM @sampleTable
OPEN MY_CURSOR
FETCH NEXT FROM MY_CURSOR INTO @contractTypeFinalDependent1, @contractTypeFinal1
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM MY_CURSOR INTO @contractTypeFinalDependent1, @contractTypeFinal1
END
CLOSE MY_CURSOR
DEALLOCATE MY_CURSOR
SELECT * FROM MY_CURSOR