Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8652

Re: How do I perform a meaningful join on monSysStatement and monSysSQLText?

$
0
0

You're (obviously?) going to be limited to SPID/KPID/InstanceID/BatchID.

 

Keep in mind that a 'batch' of SQL text could include many statements, eg:

 

=================== 1 batch, 5 statements

declare @a int

select @a = 5

select @a = @a + @@maxpagesize

select getdate()

select 'get me out of here'

go

=================== 1 batch, # of statements depends on size of mycur result set

declare @myvalue varchar(100)

open mycur

fetch mycur into @myvalue

while @@sqlstatus = 0

begin

     ... do something with @myvalue

     fetch mycur into @myvalue

end

close mycur

go

===================

 

SQL text is stored as a batch (not as individual statements) in monSysSQLText, so there's no easy way to match a statement to a line of SQL text.  (I'm not saying it can't be done with some additional T-SQL programming ... it's just not doable with the current MDA table column definitions.)


Viewing all articles
Browse latest Browse all 8652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>