如何用sql命令获取ip地址 - MS-SQL Server / 应用实例
如何用sql命令获取当前数据库服务器的ip地址
学习,帮顶
SQL code:
exec master..xp_cmdshell 'ipconfig'
SQL code:
SELECT @@SERVERNAME
SQL code:
create Procedure sp_get_ip_address (
@ip varchar(40) out
)
as
begin
Declare @ipLine varchar(200)
Declare @pos int
set nocount on
set @ip = NULL
Create table #temp (ipLine varchar(200))
Insert #temp exec master..xp_cmdshell 'ipconfig'
select @ipLine = ipLine from #temp where upper (ipLine) like '%IP ADDRESS%'
if (isnull (@ipLine,'***') != '***')
begin
set @pos = CharIndex (':',@ipLine,1);
set @ip = rtrim(ltrim(substring (@ipLine ,@pos + 1 ,len (@ipLine) - @pos)))
end
drop table #temp
set nocount off
end
go
declare @ip varchar(40)
exec sp_get_ip_address @ip out print @ip
SQL code:
create table #tmp(aa varchar(200))
insert #tmp exec xp_cmdshell 'ipconfig'
select s
相关问答:
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......
我觉得mysql和sqlserver有共同的地方:
有个问题是关于表的锁问题:
进程A 进程B
select * from user where id in lock share mode(共享锁)
&nb ......
查询学生平均成绩及其名次
SELECT 1+(SELECT COUNT( distinct 平均成绩)
from (SELECT S#,AVG(score) AS 平均成绩
from SC&n ......