Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > sql server (microsoft) > august 2005 >

sql server (microsoft) : Convert Decimal to IP?


bradwiseathome NO[at]SPAM hotmail.com
8/16/2005 8:09:29 PM

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

THanks.
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