Whois lookup from stored procedure

  • Anybody out there have any experience or suggestions for a stored procedure to perform a whois lookup on an ip and write the data back to the record?

    Thanks,

    Mark

  • Need an external control to do this. You could use sp_oacreate to instantiate some COM object that can handle this. Or run a program from DOS and pipe the output to a file. The read the file into SQL Server.

  • To extend on Steve, here's a code snippet that might give you some ideas

    set nocount on

    declare @ip varchar(255), @cmd varchar(100)

    set @cmd = 'ping ' + HOST_NAME()

    create table #temptb (grabfield varchar(255))

    insert into #temptb exec master.dbo.xp_cmdshell @cmd

    select @ip = substring(grabfield,  charindex('[',grabfield)+1,

    charindex(']',grabfield)-charindex('[',grabfield)-1) from #temptb  where left(grabfield,7) = 'Pinging'

    print @ip

    drop table #temptb

    set nocount off

     

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply