Accesing tables rows in Stored procedure without using cursors

Please support our MS SQL advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2006
Posts: 2
Reputation: sarvesh jaiswar is an unknown quantity at this point 
Solved Threads: 0
sarvesh jaiswar sarvesh jaiswar is offline Offline
Newbie Poster

Accesing tables rows in Stored procedure without using cursors

 
0
  #1
Aug 30th, 2006
From last two days i am searching for the answer of this querry.
I want to know how can i access the rows of tables in stored procedures using loops(Without cursor).
We don't want to use cursor for that because of the performance issues.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 7
Reputation: itsdavetime is an unknown quantity at this point 
Solved Threads: 1
itsdavetime itsdavetime is offline Offline
Newbie Poster

Re: Accesing tables rows in Stored procedure without using cursors

 
0
  #2
Sep 1st, 2006
Just to a while loop.

declare @rowcount int,
@counter int
select @rowcount = (select count(*) from table_name)

set @counter = 0
while @counter <= @rowcount
begin
select * from table_name where rowid = @counter
set @counter = @counter + 1
end
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2
Reputation: sarvesh jaiswar is an unknown quantity at this point 
Solved Threads: 0
sarvesh jaiswar sarvesh jaiswar is offline Offline
Newbie Poster

Re: Accesing tables rows in Stored procedure without using cursors

 
0
  #3
Sep 4th, 2006
Originally Posted by itsdavetime View Post
Just to a while loop.

declare @rowcount int,
@counter int
select @rowcount = (select count(*) from table_name)

set @counter = 0
while @counter <= @rowcount
begin
select * from table_name where rowid = @counter
set @counter = @counter + 1
end

MY REPLY:
What was rowid here. It was giving invalid column name in SQL SERVER. PLZ reply soon.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 521
Reputation: pty is on a distinguished road 
Solved Threads: 37
pty's Avatar
pty pty is offline Offline
Posting Pro

Re: Accesing tables rows in Stored procedure without using cursors

 
0
  #4
Sep 4th, 2006
Originally Posted by sarvesh jaiswar View Post
MY REPLY:
What was rowid here. It was giving invalid column name in SQL SERVER. PLZ reply soon.
your auto-incrementing id field
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC