var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: sort IP and find max and min
Im struggling with
MIN(CAST(PARSENAME (ipaddress,1) as decimal)) + '&' + MAX(CAST(PARSENAME(ipaddress,1) as decimal)) as LowestAndHigestIP
get error message "Error converting data type varchar to numeric." i guess that '&' is the issue. i want to be able to sort high and low IP like number not string.
ipaddress is varchar
any suggestions how to solve this?
Last edited by mrpcguy; 11-28-13 at 11:20.
You're getting the Min() and Max() of a decimal.
You are then trying to concatenate these decimals to a string. You can't do this, you'll have to cast to strings across.
My suggestion would be to get the max and min and then work on the presentation part. So something like
Select Cast(ip.minIP as varchar) + ' & ' + Cast(ip.maxIP as varchar)
(Select minIP = min(ipAddress), maxIP = max(ipAddress)
From ipTable) ip
of course, thanks for solution.