SQL Stored Procedure If Else
Posted on 2008-06-16
What is the best way to condition on a Select query is a Stored Procedure to determine whether to process code or not?
Let's say I have --> Select EngineHP from Motor where EngineSize = '400'
I would want to process some code in the S/P is the query returned a record with a value for EngineHP.
If no value found/retrieved issue to User "EngineSize not found"
I have tried a CURSOR but could not get that to work.
What would be my best option here?