declare @ip1 varchar(20)
declare @ip2 varchar(20)
set @ip1='221.231.138.101'
set @ip2='255.255.255.255'
select count(1) from vhhostlist
where (cast(dbo.split(s_serverip,'.',0) as bigint)*(256*256*256)
+cast(dbo.split(s_serverip,'.',1) as bigint)*(256*256)
+cast(dbo.split(s_serverip,'.',2) as bigint)*256
+cast(dbo.split(s_serverip,'.',3) as bigint))>=(cast(dbo.split(@ip1,'.',0) as bigint)*(256*256*256)
+cast(dbo.split(@ip1,'.',1) as bigint)*(256*256)
+cast(dbo.split(@ip1,'.',2) as bigint)*256
+cast(dbo.split(@ip1,'.',3) as bigint))
and (cast(dbo.split(s_serverip,'.',0) as bigint)*(256*256*256)
+cast(dbo.split(s_serverip,'.',1) as bigint)*(256*256)
+cast(dbo.split(s_serverip,'.',2) as bigint)*256
+cast(dbo.split(s_serverip,'.',3) as bigint))<=(cast(dbo.split(@ip2,'.',0) as bigint)*(256*256*256)
+cast(dbo.split(@ip2,'.',1) as bigint)*(256*256)
+cast(dbo.split(@ip2,'.',2) as bigint)*256
+cast(dbo.split(@ip2,'.',3) as bigint))