Convert Number to IP address.
Use the following query to convert the number into an IP Address..
DECLARE @IP_NUM AS INTEGER
SET @IP_NUM=1135863234
SELECT CAST(@IP_NUM/16777216 AS VARCHAR(3)) +'.'+
CAST((@IP_NUM%16777216)/65536 AS VARCHAR(3)) +'.'+
CAST( ((@IP_NUM%16777216)%65536)/256 AS VARCHAR(3)) +'.'+
CAST(((@IP_NUM%16777216)%65536)%256 AS VARCHAR(3))
Result:
67.179.229.194
Please give some suggestion to make it better.
Use the following query to convert the number into an IP Address..
DECLARE @IP_NUM AS INTEGER
SET @IP_NUM=1135863234
SELECT CAST(@IP_NUM/16777216 AS VARCHAR(3)) +'.'+
CAST((@IP_NUM%16777216)/65536 AS VARCHAR(3)) +'.'+
CAST( ((@IP_NUM%16777216)%65536)/256 AS VARCHAR(3)) +'.'+
CAST(((@IP_NUM%16777216)%65536)%256 AS VARCHAR(3))
Result:
67.179.229.194
Please give some suggestion to make it better.
No comments:
Post a Comment