Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want create stored procedure which can perform selecting data of particular column of row one by one row as foreach and want every selecting value can perform some additional logic.
Posted
Comments
[no name] 28-Dec-12 5:33am    
Not clear with ur need..please make it more clear..try to give some demo example...
Dharmendra-18 28-Dec-12 5:43am    
suppose we have 10 rows of data when we fire select statement query with where condition then suppose 5 rows are selected and we want access every row data for particular calculation, then what we do....

1 solution

Hi,

You need to use CURSOR for that.

See MSDN Information[^]

See example in this[^] link

Best luck.
 
Share this answer
 
Comments
Dharmendra-18 28-Dec-12 5:48am    
suppose we have 10 rows of data when we fire select statement query with where condition then suppose 5 rows are selected and we want access every row data for particular calculation, then what we do....
AmitGajjar 28-Dec-12 5:57am    
DECLARE vend_cursor CURSOR FOR SELECT * FROM Purchasing.Vendor where vendorname like 'a%'


Dharmendra-18 28-Dec-12 6:07am    
I have little bit knowledge of Cursor if you have any good tutorial then provide me
AmitGajjar 28-Dec-12 6:08am    
go to the MSDN link that i have provided.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900