I need to write a cursor that allows me to execute a stored procedure for each row found on my first query.
I want to do something like this:
My first query returns a set of values based on X criteria
WHERE DATA_STATUS = 'Generated Work Order to E.S.'
and ENTERED_DATE <=
CONVERT(VARCHAR(10), DATEADD(day, -180, GETDATE()), 101)
a set of X NUMBER_KEY are returned and i need to execute the following stored procedure:
usp_DAL_UpdateViolationStatus passing the NUMBER_KEY value, 'some text', and todays date in short format. whats the best practice to do this?