获取服务器名称:
SELECT SERVERPROPERTY('MachineName')
select @@SERVERNAME
select HOST_NAME()
获取IP地址可以使用xp_cmdshell执行ipconfig命令:
--开启xp_cmdshell
exec sp_configure'show advanced options', 1
reconfigure with override
exec sp_configure'xp_cmdshell', 1
reconfigure with override
exec sp_configure'show advanced
1