August 11, 2016 at 8:52 am
Hi gurus,
I need to join ::fn_trace_gettable TO sys.procedures. So I get extra below columns.
DDL operations (Alter)
'HostName (server Name)
, DatabaseName
,LoginName
,ApplicationName
Thanks in advance.
August 11, 2016 at 8:57 am
SELECT *
FROM fn_trace_geteventinfo(@id) EI
INNER JOIN sys.procedures
ON procedures.name = TE.name
Or did you want something else?
August 11, 2016 at 9:05 am
Thanks Steve for your quick reply but I am getting this:
Msg 137, Level 15, State 2, Line 2
Must declare the scalar variable "@id".
August 11, 2016 at 9:09 am
Tac11 (8/11/2016)
Thanks Steve for your quick reply but I am getting this:Msg 137, Level 15, State 2, Line 2
Must declare the scalar variable "@id".
That would be because @id is an int that would be the handle. Did you define that variable?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 11, 2016 at 9:13 am
DECLARE @id INT;
SELECT @id = id
FROM sys.traces
WHERE is_default = 1;
August 11, 2016 at 9:17 am
Sorry, realized I changed your function. You can do it this way as well. Change the join if that's not appropriate for your system
DECLARE @path VARCHAR(500)
SELECT @path = path
FROM sys.traces
WHERE is_default = 1
SELECT *
FROM fn_trace_gettable(@path, DEFAULT) t
INNER JOIN sys.procedures p
ON t.ObjectName = p.name
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply