When trying to compare software versions 5.12 to 5.8, version 5.12 is newer, however mathematically 5.12 is less than 5.8. How would I compare the two versions so that a new
As suggested by AF you can compare the int part and then the decimal part .Apart from all the answers given there is one more way to do it using parsename .You could try something like this
case when cast(@var as int)>cast(@var2 as int) then 'Y'
when cast(PARSENAME(@var,1) as int) > cast(PARSENAME(@var2,1) as int) THEN 'Y'
Declare @var float
Declare @var2 float
set @var=5.14
set @var2=5.8
Select case when cast(@var as int)>cast(@var2 as int) then 'Y'
when cast(PARSENAME(@var,1) as int)> cast(PARSENAME(@var2,1) as int) THEN 'Y'
else 'N' END