sql 中写个将Ip转换为数值的函数? sql 中写个将Ip转换为数值的函数? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我写过,你可以试试这个:CREATE FUNCTION [dbo].[F_IPAddressToInt64]( @IPAddress varchar(20) -- IP地址)RETURNS bigint ASBEGIN declare @No1Dot int declare @No2Dot int declare @No3Dot int select @No1Dot = charindex('.', @IPAddress, 1) if (@No1Dot = 0) begin return 0 end select @No2Dot = charindex('.', @IPAddress, @No1Dot + 1) if (@No2Dot = 0) begin return 0 end select @No3Dot = charindex('.', @IPAddress, @No2Dot + 1) if (@No3Dot = 0) begin return 0 end declare @Num1 bigint declare @Num2 bigint declare @Num3 bigint declare @Num4 bigint set @Num1 = cast(substring(@IPAddress, 1, @No1Dot - 1) as int) set @Num2 = cast(substring(@IPAddress, @No1Dot + 1, @No2Dot - @No1Dot - 1) as int) set @Num3 = cast(substring(@IPAddress, @No2Dot + 1, @No3Dot - @No2Dot - 1) as int) set @Num4 = cast(substring(@IPAddress, @No3Dot + 1, len(@IPAddress) - @No3Dot) as int) return (@Num1 * 256 *256 * 256) + (@Num2 * 256 * 256) + (@Num3 * 256) + @Num4END 如何配置ODBC数据源 ASP.net配合MYSQL做的登录模块登录成功,但是验证出问题,请帮忙 C#高级编程第6版里的问题 备份代码 怎么办,计算速度很慢啊... 请问js读取HttpCookie写的cookie remoting传递引用是否是透明的? 请问如何比较两个image类型的对象所表示的图片是否相同? 下面的代码的作用是找到窗口内的RichEdit20A控件,但是如果是想找到listview控件应该写什么呢? 最近用CefSharp做了一个外壳,随之出现了一个很怪的问题 Ilist的问题,麻烦进来看看 C# 调用 C++ Dll 封送数据问题
(
@IPAddress varchar(20) -- IP地址
)RETURNS bigint ASBEGIN
declare @No1Dot int
declare @No2Dot int
declare @No3Dot int select @No1Dot = charindex('.', @IPAddress, 1)
if (@No1Dot = 0)
begin
return 0
end select @No2Dot = charindex('.', @IPAddress, @No1Dot + 1)
if (@No2Dot = 0)
begin
return 0
end select @No3Dot = charindex('.', @IPAddress, @No2Dot + 1)
if (@No3Dot = 0)
begin
return 0
end declare @Num1 bigint
declare @Num2 bigint
declare @Num3 bigint
declare @Num4 bigint set @Num1 = cast(substring(@IPAddress, 1, @No1Dot - 1) as int)
set @Num2 = cast(substring(@IPAddress, @No1Dot + 1, @No2Dot - @No1Dot - 1) as int)
set @Num3 = cast(substring(@IPAddress, @No2Dot + 1, @No3Dot - @No2Dot - 1) as int)
set @Num4 = cast(substring(@IPAddress, @No3Dot + 1, len(@IPAddress) - @No3Dot) as int) return (@Num1 * 256 *256 * 256) + (@Num2 * 256 * 256) + (@Num3 * 256) + @Num4
END