| Author: Antony s Nasarath 07 Oct 2008 | Member Level: Silver | Rating: Points: -20 |
Hi You can use cursor for this and cursor basically get set of selected record and you can loop thought each record and do whatever you want
Code sam[ple
DECLARE @AuthorID char(11) DECLARE c1 CURSOR READ_ONLY FOR SELECT au_id FROM authors
OPEN c1
FETCH NEXT FROM c1 INTO @AuthorID
WHILE @@FETCH_STATUS = 0 BEGIN
PRINT @AuthorID
FETCH NEXT FROM c1 INTO @AuthorID
END
CLOSE c1 DEALLOCATE c1
for more inof visit http://www.sqlteam.com/article/cursors-an-overview
Regards
|
| Author: victoria 07 Oct 2008 | Member Level: Gold | Rating: Points: 2 |
check this link..
http://www.eggheadcafe.com/software/aspnet/30737775/how-to-set-up-a-for-loop.aspx
|
| Author: karthikeyan-The Great 07 Oct 2008 | Member Level: Gold | Rating: Points: -20 |
use cursor
the term cursor refers to a control structure for the successive traversal (and potential processing) of records in a result set.
A cursor is used for processing individual rows returned by the database system for a query.
|