Is it possible to do something like this?
declare @ShouldBeNumber as varchar(10)
set @ShouldBeNumber = 1
declare @Number as varchar(10)
select @Number = case when ISNUMERIC(@ShouldBeNumber) then @Number = @ShouldBeNumber else @Number = '' end
i.e. only assign the variable if it is numeric. I have spent the last hour Googling this and have not found anything.
For example, I have looked here: How to check if a variable has a value in a SQL Server 2008 stored procedure