User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 427,025 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,540 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 7231 | Replies: 3
Reply
Join Date: Aug 2006
Posts: 2
Reputation: sarvesh jaiswar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sarvesh jaiswar sarvesh jaiswar is offline Offline
Newbie Poster

Question Accesing tables rows in Stored procedure without using cursors

  #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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Posts: 7
Reputation: itsdavetime is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
itsdavetime itsdavetime is offline Offline
Newbie Poster

Re: Accesing tables rows in Stored procedure without using cursors

  #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  
Join Date: Aug 2006
Posts: 2
Reputation: sarvesh jaiswar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sarvesh jaiswar sarvesh jaiswar is offline Offline
Newbie Poster

Re: Accesing tables rows in Stored procedure without using cursors

  #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  
Join Date: Oct 2005
Location: Manchester, UK
Posts: 482
Reputation: pty is on a distinguished road 
Rep Power: 3
Solved Threads: 33
pty's Avatar
pty pty is offline Offline
Posting Pro in Training

Re: Accesing tables rows in Stored procedure without using cursors

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 2:52 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC