需要将一些代码从MySql移动到TSql.我有一些对INET_ATON的调用,它将类似于IPAddress的字符串转换为数字.是否有T-SQL等价物?
滥用parsname函数:
create function INET_ATON (@addr varchar(15)) returns bigint with schemabinding as begin return cast(parsename(@addr, 4) as bigint) * 16777216 + cast(parsename(@addr, 3) as bigint) * 65536 + cast(parsename(@addr, 2) as bigint) * 256 + cast(parsename(@addr, 1) as bigint) end
但是,这里不支持"简短地址"的事情.