Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

Using Dynamic Cursor Options
walidkayrouz
Posted: Thursday, August 02, 2007 4:43:36 AM
Rank: Newbie

Joined: 8/2/2007
Posts: 1
Points: 3
I'm using Cursor cause i have to display data in a Grid
for example from row 100 to 120 how can i get result if i dont use cursor?

an example for the Cursor
1)Created a dynamic cursor :

DECLARE authors_cursor CURSOR DYNAMIC
FOR Select DISTINCT LOCATION_EN AS "0Location" from am_location WHERE LOCATION_ID = 7
OPEN authors_cursor
FETCH first FROM authors_cursor

2)The result for this cursor is for expamle 'USA'.
3) If now i do an update on that location with a new value 'USA1'

update am_location set location_en = 'USA1' WHERE LOCATION_ID = 7

4)now if i fetch the cursor , i''ll get the old value (USA) not (USA1).
- DISTINCT will always result in a static cursor.

If i remove DISTINCT from the cursor declaration , the process works fine.

n.b:I'm using sql server 2000.
Scott Whigham
Posted: Tuesday, August 07, 2007 11:58:08 AM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
Sorry I haven't answered sooner but honestly, I just don't want to answer any questions about cursors lol.

Anyway, I'm a bit clueless as to what exactly your question is. Is your question how to get rows 100-120? Or is your question about how dynamic/keyset cursors work? Or both?
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnWindows2003.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.