# Returning the title of a record

I want to return the title of a record if one exists or the word 'invalid' if not:

    @ID int ,
@Title nvarchar(50) output
...
if exists(select * from MyTable where ID=@ID)
select @Title = (select Title from MyTable where ID=@ID);
else select @Title = 'invalid';


but I don't have a good feeling with this query.

// Default value