Reputation: 13
I have a table BounceStatistics
with the columns: Email_Address
,Bounces
,Status
,Week
,Year
i have a stored procedure named GetStatus
with the following parametersEmail_address
,Week
,Year
.
The procedure fills the status column of the BounceStatistics table collected out of another set of tables.
My Question:
How do i run the stored procedure for each record in BounceStatistics
where the value is currently null
?
(i read that i should avoid loops but i think its the only way)
I would love to learn better practises as well, so any tips on what i should do in the future instead of what i show right now would be welcome.
Upvotes: 0
Views: 143
Reputation: 4137
It looks like the SP was written specifically to update (or insert?) a single row.
This in itself is problematic.
Think about rewriting it as a function and calling it as part of an UPDATE statement.
And yes, loops should be avoided (and usual can be avoided) ;-)
Upvotes: 1