IsNumeric() is not always right, e.g. ' - ' and '.' both return 1 for IsNumeric, but will fail your query.
This function (Adapted from here)
create function dbo.GetNumeric(@x varchar(10)) returns float as
begin
return
case
when @x is null or @x = '' then null -- blanks
when @x like '%[^0-9e.+-]%' then null -- non valid char found
when @x like 'e%' or @x like '%e%[e.]%' then null -- e cannot be first, and cannot be followed by e/.
when @x like '%e%_%[+-]%' then null -- nothing must come between e and +/-
when @x='.' or @x like '%.%.%' then null -- no more than one decimal, and not the decimal alone
when @x like '%[^e][+-]%' then null -- no more than one of either +/-, and it must be at the start
when @x like '%[+-]%[+-]%' and not @x like '%[+-]%e[+-]%' then null
else convert(float,@x)
end
end
Your query (involving inequality)
where users.id >= case when IsNull(dbo.GetNumeric(trans.id),0)
And if trans.id does not involve decimal points
where user.id >= case when trans.id not like '%[^0-9]%' and trans.id >''
then trans.id end
Of course, if it's a simple equality, just cast the int to a varchar
where right(users.id,10) = trans.id