944,209 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 16658
  • MS SQL RSS
Aug 30th, 2006
0

Accesing tables rows in Stored procedure without using cursors

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sarvesh jaiswar is offline Offline
2 posts
since Aug 2006
Sep 1st, 2006
0

Re: Accesing tables rows in Stored procedure without using cursors

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
itsdavetime is offline Offline
7 posts
since Aug 2006
Sep 4th, 2006
0

Re: Accesing tables rows in Stored procedure without using cursors

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sarvesh jaiswar is offline Offline
2 posts
since Aug 2006
Sep 4th, 2006
0

Re: Accesing tables rows in Stored procedure without using cursors

MY REPLY:
What was rowid here. It was giving invalid column name in SQL SERVER. PLZ reply soon.
your auto-incrementing id field
pty
Reputation Points: 64
Solved Threads: 39
Posting Pro
pty is offline Offline
530 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Drop User In Mssql
Next Thread in MS SQL Forum Timeline: Modal Function





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC