ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278k

How to use Cursor to Execute stored procedure where featurevalue is b?

Dec 20 2020 12:03 PM
How to use Cursor to Execute stored procedure where featurevalue is bigger than 0 ?
I work on SQL server 2012 . I face issue I can't use cursor to execute stored procedure when feature value is bigger than 0 .
I have stored procedure must execute with every line where feature value is bigger than 0
so according to my case I will use cursor to execute stored procedure with feature value that bigger than 0
so EXEC sp_updatevaluesonTables 10,30,40,50
this sp pass to it feature value to do some thing update and insert data
so How to use cursor to execute stored procedure sp_updatevaluesonTables with every value bigger than 0
as
cursor
EXEC sp_updatevaluesonTables 10,30,40,50
end cursor
im not use cursor before so can you help me
  1. create table #updatestatus  
  2. (  
  3. FeatureValue int,  
  4. status nvarchar(50)  
  5. )  
  6. insert into #updatestatus  
  7. values  
  8. (10,NULL),  
  9. (50,NULL),  
  10. (-2,NULL),  
  11. (-3,NULL),  
  12. (30,NULL),  
  13. (40,NULL)  
  14. SELECT * FROM #updatestatus WHERE FeatureValue>0  
  15. Exec sp_updatevaluesonTables FEATUREVALUE  

Answers (2)