How can i resolve a hostname in t-sql? a 2000 compatible method is preferred. Although something that works on 2005/2008 would also be helpful.
eg. If i have the hostname stackoverflow.com i want to return 69.59.196.211
How can i resolve a hostname in t-sql? a 2000 compatible method is preferred. Although something that works on 2005/2008 would also be helpful.
eg. If i have the hostname stackoverflow.com i want to return 69.59.196.211
Well, I suppose you could use xp_cmdshell to execute nslookup and parse the results. Seems like a really awkward thing for SQL Server to be doing, though.
exec master..xp_cmdshell 'nslookup intel.com'
.. then you'll probably want to stuff that in a temp table and walk through the results.
You could also, if you can get access to SQL Server 2005 or 2008, build a stored procedure or function in .NET and do a simple call to Dns.GetHostAddresses()
.