• subscribe
July 19, 2005 12:00 AM

Performing a Reverse DNS Lookup

SQL Server Pro
InstantDoc ID #46892

Is it possible to perform a reverse DNS lookup in a stored procedure or from a SQL Server Agent job?

You can use a simple technique that relies on xp_cmdshell to perform a reverse DNS lookup. Xp_cmdshell can be a security risk if not managed properly, but it can also be a powerful tool for doing specialized tasks in a controlled manner from T-SQL. For example, you can use the following code, then manipulate the output any way you need to.

DECLARE @OSCmd varchar(8000)
DECLARE @DomainName varchar(8000)
SET @DomainName  = 'www.solidqualitylearning.com'
SET @OSCmd = 'NSLOOKUP ' + @DomainName
EXEC master.dbo.xp_cmdshell @OSCmd


ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...