DECLARE @a uniqueidentifier, @b uniqueidentifier, @c datetime, @d numeric(15, 2)
DECLARE MyCursor CURSOR FOR
SELECT Z.ID, Z.Name, Z.Date, (V1.Credit - V2.Debet) AS Money
FROM dbo.Table1 V1
INNER JOIN dbo.Table1 V2
ON V2.Name = V1.Name AND V2.ID = V1.ID AND V2.Date = V1.Date
INNER JOIN dbo.Table2 Z
ON Z.Name = V1.Name AND Z.ID = V1.ID AND Z.Date = V1.Date
WHERE V1.Date = DATEADD(Day, Z.AllowedDays, V2.Date)
OPEN MyCursor
FETCH NEXT FROM MyCursor INTO @a, @b, @c, @d
-- Get stuck here!!!
print 'My Cursor goes ahead'
WHILE @@FETCH_STATUS = 0
BEGIN
...
私の場合、なぜそれが動かなくなるのか誰かが説明できますか? スタンドアロンの Select 自体が完了しているため、理由がわかりません。