To make it more simplier, this should work fine. If you assign this to a variable based on the datatype of your idnumber than you would be able to evaluate whether the value is null or the actual idnumber return.
SELECT ISNULL(
(
SELECT idnumber
FROM dbo.database
WHERE number = '9823474'
), NULL)