日期:2014-05-19  浏览次数:20503 次

====== 如何用SQL语句把主机名转成IP地址? ======
如何用SQL语句把主机名转成IP地址?

比如:   (local)   ->   192.168.0.2

                        .   ->   192.168.0.2

          myserver   ->   192.168.0.2


------解决方案--------------------
这个可能要用到API吧。。呵呵~~不清楚,帮顶
------解决方案--------------------
if object_id( 'TestTable ') is not null
drop table TestTable
create table TestTable(a varchar(1000))
insert TestTable exec master..xp_cmdshell 'ping 主机名 '
select substring(a,charindex( '[ ',a)+1,charindex( '] ',a)-charindex( '[ ',a)-1) from TestTable where charindex( '[ ',a)> 0
------解决方案--------------------
樓上的必須用SA執行
------解决方案--------------------
学习