Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-06-27 : 02:18:45
|
declare @emp varchar(50),@ctr intdeclare cur_test cursor for select emp from employeesopen cur_testfetch next from cur_test into @empwhile @@fetch_status=0beginselect @ctr=?fetch next from cur_test into @empendclose cur_testdeallocate cur_testi wanna to know total records of cur_testthanks in advance |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-27 : 02:21:30
|
put a counter variable with intial value 1 and increment it inside while loop. at the end of loop, you'll get count of records parsed by cusrsor. |
 |
|
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-06-27 : 02:37:41
|
quote: Originally posted by visakh16 put a counter variable with intial value 1 and increment it inside while loop. at the end of loop, you'll get count of records parsed by cusrsor.
that i can get by using count in the select queryi want to know is there any built-in procedure or function to get the count of dynamic cursor |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-27 : 04:27:42
|
Yes. I think it's called @@CURSOR_ROWS. E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-27 : 09:43:42
|
quote: Originally posted by DURGESH declare @emp varchar(50),@ctr intdeclare cur_test cursor for select emp from employeesopen cur_testfetch next from cur_test into @empwhile @@fetch_status=0beginselect @ctr=fetch next from cur_test into @empendclose cur_testdeallocate cur_testi wanna to know total records of cur_testthanks in advance
What are you doing with this code?MadhivananFailing to plan is Planning to fail |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-02 : 08:55:15
|
quote: Originally posted by DURGESH declare @emp varchar(50),@ctr intdeclare cur_test cursor for select emp from employeesopen cur_testfetch next from cur_test into @empwhile @@fetch_status=0beginselect @ctr=?fetch next from cur_test into @empendclose cur_testdeallocate cur_testi wanna to know total records of cur_testthanks in advance
Dont edit the QuestionPost it as new replyCan count(*) do what you need?MadhivananFailing to plan is Planning to fail |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-02 : 15:35:52
|
Read about @@CURSOR_ROWS in Books Online. E 12°55'05.25"N 56°04'39.16" |
 |
|
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-07-03 : 05:51:54
|
yes i wanna know how records were selected by cursorcur_testthanks in advance |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-07-03 : 05:59:46
|
quote: Originally posted by DURGESH yes i wanna know how records were selected by cursorcur_testthanks in advance
Not sure what do you mean by that. Could you elaborate?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|