社区
应用实例
帖子详情
SqlServer2000有这样的功能吗?
jtg98g3
2005-08-06 02:28:04
在客户端操作数据的时候,能记录客户端的ip地址或者主机名。然后能从历史记录中查到这样的操作记录。
...全文
230
10
打赏
收藏
SqlServer2000有这样的功能吗?
在客户端操作数据的时候,能记录客户端的ip地址或者主机名。然后能从历史记录中查到这样的操作记录。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
10 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
iwl
2005-08-20
打赏
举报
回复
coolnick(林息) 的可以
iwl
2005-08-20
打赏
举报
回复
楼上的可以
chinawares
2005-08-18
打赏
举报
回复
楼上的想法有道理,找出系统中的活动主机名,然后逐一ping这么主机名,就可以得到ip,高
coolnick
2005-08-18
打赏
举报
回复
不好意思,上面的有点错误,下面的程序调试通过:
if exists(select name from sysobjects where name='sp_GetClientIp'
and type='P')
drop procedure sp_GetClientIp
go
/*
exec sp_GetClientIp
select * from tableResult
*/
create procedure sp_GetClientIp
as
begin
create table #ip
(
id int identity(1,1),
re varchar(200)
)
if exists(select name from sysobjects where name='tableResult'
and type='U')
begin
drop table tableResult
end
create table tableResult
(
hostName varchar(100),
hostIp varchar(50)
)
declare cur_List cursor for
select hostname from master..sysprocesses
open cur_List
declare @hostName varchar(100),@s varchar(1000)
fetch next from cur_List into @hostName
while (@@fetch_status=0)
begin
if (@hostName='')
begin
fetch next from cur_List into @hostName
continue
end
set @s='ping '+ @hostName +' -n 1 -l 1'
insert #ip(re) exec master..xp_cmdshell @s
insert into tableResult(hostName,hostIp)
select
@hostName,
stuff(left(re,charindex(']',re)-1),1,charindex('[',re),'')
from #ip
where id=2
truncate table #ip
fetch next from cur_List into @hostName
end
close cur_List
deallocate cur_List
end
go
coolnick
2005-08-18
打赏
举报
回复
create procedure sp_GetClientIp
as
begin
create table #ip
(
id int identity(1,1),
re varchar(200)
)
if exists(select name from sysobjects where name='tableResult'
and type='U')
begin
drop table tableResult
end
create table tableResult
(
hostName varchar(100),
hostIp varchar(50)
)
declare cur_List cursor for
select hostname from master..sysprocesses
open cur_List
declare @hostName varchar(100),declare @s varchar(1000)
fetch next from cur_List into @hostName
while (@@fetch_status=0)
begin
set @s='ping '+ @hostName +' -a -n 1 -l 1'
insert #ip(re) exec master..xp_cmdshell @s
insert into tableResult(hostName,hostIp)
select
@hostName,
stuff(left(re,charindex(']',re)-1),1,charindex('[',re),'')
from #ip
where id=2
fetch next from cur_List into @hostName
end
close cur_List
deallocate cur_List
end
go
最后得到的结果表tableResult就包含客户端的ip地址或者主机名
netcoder
2005-08-17
打赏
举报
回复
目前还没有,如果有的话,感觉太消耗资源
AppleBBS
2005-08-17
打赏
举报
回复
程序里写就ok了
jtg98g3
2005-08-08
打赏
举报
回复
服务器没有提供这样的功能吗?
比如能查询到某天的所有对数据库的操作!
ilons1
2005-08-06
打赏
举报
回复
在程序里可以自己把IP当参数传进来,自己做LOG就行了
Andy__Huang
2005-08-06
打赏
举报
回复
得到服务器的IP地址
create table #ip(id int identity(1,1),re varchar(200))
declare @s varchar(1000)
set @s='ping '+left(@@servername,charindex('\',@@servername+'\')-1)+' -a -n 1 -l 1'
insert #ip(re) exec master..xp_cmdshell @s
select 服务器名=@@servername,IP地址=stuff(left(re,charindex(']',re)-1),1,charindex('[',re),'')
from #ip
where id=2
drop table #ip
獲得主機名
select host_name()
Microsoft SQL Server
2000
的国际化
功能
Microsoft SQL Server
2000
的国际化
功能
点击此处阅读全文
使用SQL SERVER
2000
的全文检索
功能
使用SQL SERVER
2000
的全文检索
功能
步骤:1、 打开NorthWind数据库,右键Products表,选择“全文索引表”,“在表上定义全文索引”,为其创建全文目录。在“全文索引向导”中,选择你需要全文查询条件的列(可以是文本或图像),我们选择Productname和QuantityPerUnit列。然后下一步,输入一个新的目录proCatalog,点击下一步。在填充调度一
SqlServer
2000
的xml
功能
在
sqlserver
2000
中对xml有支持,可以把查询直接输出xml。 使用 SQLCommand 对象的 ExecuteXmlReader 方法。ExecuteXmlReader 返回包含从 SQL Server
2000
返回的 XML 的 System.Xml.XmlReader 对象 核心代码如下,sql语句的写法为“select * from table1 For XML...
Microsoft SQL Server
2000
XML
功能
概述
Microsoft SQL Server
2000
XML
功能
概述点击此处阅读全文
如何使用SQL Server
2000
中的XML
功能
如何使用SQL Server
2000
中的XML
功能
在本文中我们将讨论如何通过T-SQL的FOR XML子句从SQL Server返回XML。本文将通过几个例子来介绍返回XML数据和架构信息的几种不同方式,还将介绍将XML转换成更令人满意的格式的方法。然后讨论OPENXML,以及将XML文档联接到数据库表和使用WriteXml和GetXml方法从数据集提取XML的方法。 S
应用实例
27,580
社区成员
68,548
社区内容
发帖
与我相关
我的任务
应用实例
MS-SQL Server 应用实例
复制链接
扫一扫
分享
社区描述
MS-SQL Server 应用实例
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章