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
- create table #updatestatus
- (
- FeatureValue int,
- status nvarchar(50)
- )
- insert into #updatestatus
- values
- (10,NULL),
- (50,NULL),
- (-2,NULL),
- (-3,NULL),
- (30,NULL),
- (40,NULL)
- SELECT * FROM #updatestatus WHERE FeatureValue>0
- Exec sp_updatevaluesonTables FEATUREVALUE