declare @ipString varchar(128)
set @ipString = '192.168.1.89'
select cast(PARSENAME (@ipString, 1) as bigint) +
cast(PARSENAME (@ipString, 2) as bigint) * 255 +
cast(PARSENAME (@ipString, 3) as bigint) * 65025 + -- 65025 = 255^2
cast(PARSENAME (@ipString, 4) as bigint) * 16581375 -- 16581375 = 255^3
set @ipString = '192.168.1.89'
select cast(PARSENAME (@ipString, 1) as bigint) +
cast(PARSENAME (@ipString, 2) as bigint) * 255 +
cast(PARSENAME (@ipString, 3) as bigint) * 65025 + -- 65025 = 255^2
cast(PARSENAME (@ipString, 4) as bigint) * 16581375 -- 16581375 = 255^3