[SQL ] 想請教cursor的用法
大家好:
目前第一次接觸到cursor,爬了一些文,但還是看不太懂用法
以下查到的說明:
Declare @CursorName Cursor
Set @CursorName = Cursor
For Select Statement
Open @CursorName
Fetch Next From @CursorName Into 變數,……
While (@@FETCH_STATUS = 0}
Begin
Do some things
Fetch Next From @CursorName Into 變數,……
end
Close @CursorName
Deallocate @CursorName
想請教如何撰寫?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.73.70.72
推
10/25 00:36, , 1F
10/25 00:36, 1F
→
10/25 00:37, , 2F
10/25 00:37, 2F
→
10/25 09:43, , 3F
10/25 09:43, 3F
→
10/30 01:47, , 4F
10/30 01:47, 4F
→
10/30 01:48, , 5F
10/30 01:48, 5F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):