为什么我的sql语句在profiler中监测到的textdata变成这个样子:
declare @p1 int
set @p1=180152681
declare @p3 int
set @p3=8
declare @p4 int
set @p4=1
declare @p5 int
set @p5=1
exec sp_cursoropen @p1 output,N'select * from tabA',@p3 output,@p4 output,@p5 output
select @p1, @p3, @p4, @p5我实际的sql语句是:select * from tabA只有在sql查询分析器中直接写的t-sql语句才会是原样的,程序中提交的都是上面这样。
这是怎么回事?我用的是win server 2003+sql server 2005

解决方案 »

  1.   

    那是 profiler 这样去定义的,跟我们怎么写无关.我们也不必去研究 profiler 里是怎么去执行的,正如我们不必太深入地去研究 select * from tb 这样的语句 MSSQL 是怎么执行的一样,它们都只是一种工具而已.
      

  2.   

    但是我用数据库引擎优化顾问去对保存的跟踪文件进行优化,它对这类的建议又是:请将declare @p1 int
    set @p1=180152681
    declare @p3 int
    set @p3=8
    declare @p4 int
    set @p4=1
    declare @p5 int
    set @p5=1
    exec sp_cursoropen @p1 output,N'select * from tabA',@p3 output,@p4 output,@p5 output
    select @p1, @p3, @p4, @p5
    替换成select * from tabA
      

  3.   

    <table cellspacing="0" cellpadding="0">
      <col width="333" />
      <col width="173" />
      <col width="111" />
      <col width="147" />
      <col width="164" />
      <tr height="19">
        <td height="19" width="333">wait_type</td>
        <td width="173">waiting_tasks_count</td>
        <td width="111">wait_time_ms</td>
        <td width="147">max_wait_time_ms</td>
        <td width="164">sigal_wait_time_ms</td>
      </tr>
      <tr height="19">
        <td height="19">SOS_SCHEDULER_YIELD</td>
        <td align="right">3407550</td>
        <td align="right">19125</td>
        <td align="right">15</td>
        <td align="right">18453</td>
      </tr>
    </table>