SQL Server Profiler Part 2: Custom Templates and Saving Data

  • Comments posted to this topic are about the item SQL Server Profiler Part 2: Custom Templates and Saving Data

  • Jack, please help me right if maybe this was done at some point but what I would really like to see is you discussing the meaning of all the events and the columns in Profiler. Excuse me also if I am jumping the gun here and it is still to come. If so, then I can't wait for it. I have been using the Profiler and sure enough I understand a lot of what is going on there but I think with a bit more knowledge I will be able to do it even better.:hehe::w00t:

    :-PManie Verster
    Developer
    Johannesburg
    South Africa

    I can do all things through Christ who strengthens me. - Holy Bible
    I am a man of fixed and unbending principles, the first of which is to be flexible at all times. - Everett Mckinley Dirkson (Well, I am trying. - Manie Verster)

  • Manie,

    I'll add it to my list, although that is more like a book than a SSC article. Have you checked out Brad McGehee's free eBook on Profiler, http://www.sqlservercentral.com/articles/books/65797/? It doesn't go into great detail on the events either, but it might be a good start.

  • Jack Corbett (6/19/2009)


    Manie,

    I'll add it to my list, although that is more like a book than a SSC article. Have you checked out Brad McGehee's free eBook on Profiler, http://www.sqlservercentral.com/articles/books/65797/? It doesn't go into great detail on the events either, but it might be a good start.

    You know what, I actually forgot that I had downloaded his e-book on Mastering Profiler. I would also not expect elaborate explanations but maybe just a little summary of what each event and column mean. I tell you what, I will, with Brad's permission, make up a summary and post it here as an article. Let me just see first what I letting myself in for.:hehe::w00t::-P

    :-PManie Verster
    Developer
    Johannesburg
    South Africa

    I can do all things through Christ who strengthens me. - Holy Bible
    I am a man of fixed and unbending principles, the first of which is to be flexible at all times. - Everett Mckinley Dirkson (Well, I am trying. - Manie Verster)

  • An explanation on the syntax of using column filters would be useful - I've spent over an hour online and cannot find a single article that explains it.

    I run a trace, showing thousands of operations, and I want to show only queries that run an update against a single table - eg table_stuff

    So I go to Column Filters, select textdata and click on the Like option and then..... nothing.

    update table_stuff, 'update table_stuff %', 'update table_stuff', "update table_stuff" all have NO EFFECT on the trace. I cannot find any syntax that actually performs the filtering I want.

  • Mitch,

    Sorry to have taken so long to reply, but I just noticed my notification email. Let me first say that I can understand your frustration. It can be very frustrating trying to get the correct filter in place. In the examples you list none would catch this statement:

    UPDATE

    table_stuff

    SET a = b

    My best suggestion for your situation would be to be liberal with your use of the wildcard (%). You could have some spaces before the code or extra spaces between so I'd recommend something like this:

    %update%table_stuff%

    Which should capture any possible combination of spaces.

    Through a little testing it also appears (I don't know for sure) that the filter on textdata may be case sensitive as well. Looking for confirmation.

  • Jack

    Thanks.. you have single-handedly restored my faith in humanity... 🙂

    I bashed this about a bit more and can add the following:

    When trying to isolate individual queries (as I was trying to do), it is useful in the Events Selection tab, under Trace Properties, to deselect everything to just leave SQL:BatchStarting (under TSQL) and RPC:Completed (under Stored Procedures, if you are running a mix of inline queries and stored procs)

    The make sure the textData checkbox is checked against each of these selections - I missed that on one of mine, and so it wont filter at all which made me think it was my filter syntax that wasn't working...

    Then the following syntax will work in the Column Filters section (select textData and then click on the Like option - or Not Like)

    %update table_get_stuff%

    update table_get_stuff%

    Both those work, don't put any quotes round the entire expression, and doesn't seem to be case sensitive (SQL 2005 Profiler)

    %update table_get_stuff% %id = 35%

    This will act, effectively, like an AND condition but needs exact syntax between the %%, else as Jack says %id%%=%%35% will take care of spaces

    Hitting 'enter' after entering a condition above creates a new empty 'Like' box. Ignore it if you dont need it, otherwise enter another condition string and it will act as an OR condition.

    Finally, I found filtering a bit 'flakey' - in that occasionally it stopped delivering some results and I needed to delete the conditions and re-enter them again to kick it back into life, though that didn't happen enough to be fully sure what was happening.

    Thanks again

  • Mitch-723412 (10/21/2009)


    Jack

    Thanks.. you have single-handedly restored my faith in humanity... 🙂

    Wow! That's a big compliment for just responding to a question on the forum for one of my articles.

    Glad I could be helpful though.

    Yup, any text filtering in Profiler is definitely flaky.

    I'm going to be doing some research about case-sensitivity because when I ran a Trace with a textdata filter of %update table_name% and changed my update statement to start with a capital U I did not get any results. I did say that it looks like it MAY be case-sensitive. If it is, I will be blogging about it.

  • Jack

    I had a look at case sensitivity - what I have just found is that the filters aren't case sensitive - ie I found that %update% and %Update% worked (while the actual query syntax itself was update).

    I also tried %UpDatE% and that worked ok.

    What I did see, however, is that randomly (it seems) when I made a CHANGE to a condition (eg changed the u to a U) then it stopped filtering on that condition, giving the impression of being case sensitive.

    Going back and changing it again seemed to kick it back into the loop, and it didn't always repeat, so if you're looking at it you need to go round the loop a lot to get the problem to appear.

    At least that was my experience - I might be missing something!

    Cheers

  • Mitch,

    Thanks for your input. I'm just reporting what I saw. It shouldn't be case-sensitive. I need to get some different VM's up to test against. I was using Profiler 2008 against SQL Server 2005 sp2, but the Profiler version shouldn't matter because it is generating the same SQL Treace behind the scenes. Any testing I do probably won't happen for at least 3 weeks as I have the PASS Summit coming up and some more blog stuff scheduled ahead of it. It'll be interesting regardless of outcome.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply