I am creating a stored proc that selects a value from a table and uses it in another procedure. If the first value that is searched doesn’t exist I need it to use a default value. I’m new to stored procs so I’m not sure of the best practices.
Here is the first select statement which may or may not return a value. If it doesn’t return a value I need to set the “@theValue” to 10 so that it can be used in the next select statement.
DECLARE @TheValue nvarchar(50)
SELECT @TheValue = deviceManager.SystemSettings.Value
FROM deviceManager.SystemSettings
WHERE (deviceManager.SystemSettings.Setting = 'expire-terminal-requests'
What would be the best solution?