快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

用SQL语句来建立跟踪的问题

下面是我用SQL的事件探察器设置跟踪,并生成的SQL脚本
现在有几个问题:

1.这个跟踪不会产生数据,用:
select * from ::fn_trace_getinfo(1)
可以看到状态是在运行,但 c:test.trc 始终是空文件

2.在事件探察器中设置筛选时,ObjectType 的说明是对应sysobjects 表的 type 列,该列是字符型,但我输入字符时要求是数字,这个数字从那里查?

3.假如只产生对 insert,update,delete 语句成功的跟踪事件应该如何设置呢? 在 事件探察器 中无相关设置,用语句设置的话只找到事件号 28, 在执行 SELECT、INSERT 或 UPDATE 语句之前发生

4.用事件探察器建立的跟踪,可以将跟踪结果保存到表中,但我下面生成的SQL脚本却不支持这个功能
--*/
/****************************************************/
/* Created by: SQL Profiler */
/* Date: 2004/06/19 16:50:05 */
/****************************************************/

-- Create a Queue
declare @rc int
declare @TraceID int
declare @maxfilesize bigint
set @maxfilesize = 5
-- Please replace the text InsertFileNameHere, with an appropriate
-- filename prefixed by a path, e.g., c:MyFolderMyTrace. The .trc extension
-- will be appended to the filename automatically. If you are writing from
-- remote server to local drive, please use UNC path and make sure server has
-- write access to your network share
exec @rc = sp_trace_create @TraceID output, 0, N’c:test’, @maxfilesize, NULL
if (@rc != 0) goto error
-- Client side File and Table cannot be scripted
-- Writing to a table is not supported through the SP’s
-- Set the events
declare @on bit
set @on = 1
exec sp_trace_setevent @TraceID, 12, 1, @on
exec sp_trace_setevent @TraceID, 12, 12, @on
exec sp_trace_setevent @TraceID, 12, 14, @on

-- Set the Filters
declare @intfilter int
declare @bigintfilter bigint
exec sp_trace_setfilter @TraceID, 10, 0, 7, N’SQL Profiler’
set @intfilter = 100
exec sp_trace_setfilter @TraceID, 22, 0, 4, @intfilter
set @intfilter = 1
exec sp_trace_setfilter @TraceID, 23, 1, 0, @intfilter
exec sp_trace_setfilter @TraceID, 35, 1, 6, N’pubs’

-- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1
-- display trace id for future references
select TraceID=@TraceID
goto finish
error:
select ErrorCode=@rc
finish:
go
返回类别: 教程
上一教程: SQL语句中的一些参数如何用变量来代替?
下一教程: 两台SQL SERVER数据同步解决方案

您可以阅读与"用SQL语句来建立跟踪的问题"相关的教程:
· 用SQL语句来建立跟踪的问题
· PHP中操作MYSQL的一些要注重的问题
· 关于MSSQL占用过多内存的问题
· 将ACCESS转化成SQL2000要注重的问题
· 关于MSSQL占用过多内存的问题
    微笑服务 优质保证 索取样品