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))

SQLServer判断一个IP是否在一个IP段里的更多相关文章

  1. js 判断一个点是否在一个多边形之内

    出处: https://github.com/substack/point-in-polygon/blob/master/index.js github: https://github.com/sub ...

  2. python中如何不区分大小写的判断一个元素是否在一个列表中

    python中判断某一个元素是否在一个列表中,可以使用关键字in 和 not in. 示例如下: 如果需要输出相应的信息,可以搭配使用if语句,这里不赘述. --------------------- ...

  3. 点在多边形内算法,C#判断一个点是否在一个复杂多边形的内部

    判断一点是否在不规则图像的内部算法,如下图是由一个个点组成的不规则图像,判断某一点是否在不规则矩形内部,先上效果图 算法实现如下,算法简单,亲试有效 public class PositionAlgo ...

  4. JavaScript 中 如何判断一个元素是否在一个数组中

    <script type="text/javascript"> var arrList=['12','qw','q','v','d','t']; console.log ...

  5. php 判断一个点是否在一个多边形区域内

    <?php class pointMap{ private static $coordArray; private static $vertx = []; private static $ver ...

  6. php判断一个值是否在一个数组中,区分大小写-也可以判断是否在键中

    function in_array_case($value,$array){ return in_array(strtolower($value),array_map('strtolower',$ar ...

  7. 判断一个字符串是不是一个合法的IP地址

    最近在笔试的时候遇到碰一道算法题, 要求判断一个字符串是不是合法的ip地址. 将我的思路发出来分享一下,不一定正确,也不一定是最优的方法.希望能分享一些交流 要求用java或者c来实现,我的java代 ...

  8. jquery 判断一个元素是否在数组中 $.inarry()使用

    需要判断一个元素是否在一个数组里: js indexOf()方法  如果存在 则返回该元素的下标值 如果不存在则返回-1 学习源头: http://www.w3school.com.cn/jsref/ ...

  9. vuex中filter的使用 && 快速判断一个数是否在一个数组中

    vue中filter的使用 computed: mapState({ items: state => state.items.filter(function (value, index, arr ...

随机推荐

  1. 2017.7.12 IDEA热部署(更新jsp或java代码不用重启tomcat即可即时生效)

    选择war explored. 主要在于 On frame deactivation选项配置选择为 Update classes and resourses(当且仅当在Deployment配置页,对应 ...

  2. 使用RAP搭建前端Mock Server

    转载自:<前后端分离--构建前端Mock Server--windows部署rap>http://www.cnblogs.com/dothin/p/5361883.html mock:模拟 ...

  3. 蓝的成长记——追逐DBA(5):不谈技术谈业务,恼人的应用系统

    ***************************************声明*************************************** 个人在oracle路上的成长记录,当中 ...

  4. 百度兴趣点下载V1.4版

    好东西就是不断的更改,升级出来的,经过连续四个版本的升级,本次版本受到用户的一致好评,也拿来在这里做个分享,期望对更多地用户起到一定的帮助! 还是一样,介绍一下其功能: 1.全国范围内的兴趣点任意区域 ...

  5. HTML图片热区

    文章来源于:https://www.cnblogs.com/mq0036/p/3337327.html <!DOCTYPE html> <html lang="en&quo ...

  6. windows下WMI使用C++查询用户硬件信息

    最近需要做下用户信息统计,发现WMI真是个好东西,同时觉得COM这东西,还真不能少>_<!! 下面是源码: /*************************************** ...

  7. 运行./cpp.sh,显示command not found

    首先运行ls -l 查看这个文件的属性是否可执行drwxrwxrwx对当前用户必须具有可执行权限(即含有x符号)如果没有可以运行chmod 777 cpp.sh 添加可执行权限

  8. AVCaptureSession

    AVCaptureSession用来控制来自一个输入设备(AVCaptureDeviceInput)的声音和视频,流入一个输出缓冲区(AVCaptureOutput)的过程. 建立一个AVCaptur ...

  9. DevOps开源工具的三种分类整理

    原文地址:http://www.360doc.com/content/16/0322/07/31263000_544210096.shtml 随着开发运维一体化的DevOps运动在国内外蓬勃发展,De ...

  10. SpringCloud系列二:硬编码实现简单的服务提供者与服务消费者

    从本文开始,以一个电影售票系统为例讲解Spring Cloud 1. 版本 jdk:1.8 SpringBoot:2.0.0.RELEASE SpringCloud:Finchley.M8 2. 系统 ...