正在加载中...
信息详页
返回SQL server中的parsename方法拆分IP地址或比例,本文主要用parsename操作ip字串:
1、统计数
select COUNT(*) from [ip] where( cast(parsename([ips], 4) as int) between 92 and 92
and cast(parsename([ips], 3) as int) between 176 and 176
and cast(parsename([ips], 2) as int) between 164 and 220
and cast(parsename([ips], 1) as int) between 0 and 255
2、指定IP
select * from ip_address_varchar
where(
cast(parsename(ipAddress, 4) as int) between 192 and 192
and cast(parsename(ipAddress, 3) as int) between 0 and 255
and cast(parsename(ipAddress, 2) as int) between 0 and 255
and cast(parsename(ipAddress, 1) as int) between 0 and 255
)