all groups > sql server (microsoft) > august 2005 >
You're in the

sql server (microsoft)

group:

Convert Decimal to IP?


Convert Decimal to IP? bradwiseathome NO[at]SPAM hotmail.com
8/16/2005 8:09:29 PM
sql server (microsoft):

Is there TSQL code out there that would convert "3232235826" to
standard IP dotted notation?

THanks.
Re: Convert Decimal to IP? Ross Presser
8/17/2005 9:58:43 AM
[quoted text, click to view]

declare @num bigint
set @num=3232235826
select
convert(varchar,(@num / 256 / 65536)) + '.' +
convert(varchar,((@num /65536) % 256)) + '.' +
convert(varchar,(@num % 256)) + '.' +
AddThis Social Bookmark Button