Here is my sample cursor code,
DECLARE test CURSOR FOR
SELECT ….
FROM tablename
where ….
OPEN test
FETCH FROM test INTO @variable
WHILE (@@fetch_status = 0)
BEGIN
Print ‘abc’
FETCH NEXT FROM test INTO @variable
END
CLOSE test
DEALLOCATE test
RETURN 0
1) Now Declare test cursor For -- What this indicates by default??
Is this a static cursor or dynamic cursor by default??
2) Also second block
SELECT ….
FROM tablename
where ….
What if someone is inserting rows in this table whicle cursor operation is going on?
3) What are the impacts if I dont write CLOSE test
But I am writing deallocate test.
Let me know.
Thanks