Where I work we use the SQL Profiler tool and I've to built trace template to target just our application scripts on our local machines. However because the template targets our machine name using the HostName column the template can't be shared without modifying it for each developer.
For example my machine name is cc-103 so in the Like clause for the HostName column filter I use that but this obviously won't work for my colleagues with different machine names.
Is there a way for the filter to determine the machine name automatically so we all can share a generic filter without having to modify the filter to replace the HostName filter with our own machine n开发者_开发知识库ame?
I have tried using T-SQL in the clause but it didn't work: e.g. Like "Select Host_Name()"
Any suggestions?
no, there isn't a way to do this in profiler. What you can do is script the template in T-SQL and run SQL Trace into a file and then opening that file in SQL Profiler or query it directly.
you can script the trace template by starting and stoping the trace in profiler then go to:
File->Export->Script Trace Definition
精彩评论