日期:2014-05-16 浏览次数:20670 次
declare @str varchar(100)
set @str = '10.110.1.123'
select cast(parsename(@str,4) as int)*cast(parsename(@str,3) as int)*cast(parsename(@str,2) as int)*cast(parsename(@str,1) as int)
create table test(ip varchar(30))
insert into test
select '10.110.1.123'
go
select ip,
v1*v2*v3*v4 v
from
(
select cast(PARSENAME(ip,4) as int) v1,
cast(PARSENAME(ip,3) as int) v2,
cast(PARSENAME(ip,2) as int) v3,
cast(PARSENAME(ip,1) as int) v4,
ip
from test
)t
/*
ip v
10.110.1.123 135300
*/