March 1, 2005 at 8:02 am
Is there a way to display the query command before the results of the query in the Query Analyzer Object Browser window? I sometimes have to run a job of multiple queries in a file and it becomes tedious to try to match up the results with the query command. I tried the "Output query" option in the "Results" tab under "Tools>Options". This displays the command, but if multiple queries are run, the commands are all displayed at the beginning of the output, not along with the associated query is run. Any suggestions?
March 1, 2005 at 9:14 am
If you are using a pre-defined script, you could try including print statements with whatever you like inside, including full syntax of your statement if that is what you want. Not sure if T-SQL has any kind of command similar to "echo" that maybe is what you are looking for. Hope that helps!
Mike
March 2, 2005 at 9:29 am
One thing I figured out is that you can use STATISTICS PROFILE to interleave the access plan in text form. You would, of course, have to have Query Analyzer in text results mode (CTRL-T) to see it. The following is a Northwind example.
SET STATISTICS PROFILE ON
SELECT TOP 1 * FROM Categories
SELECT TOP 1 * FROM Orders
SET STATISTICS PROFILE OFF
If your queries are really complex this could get a little messy, but should at least meet the specified requirements.
March 2, 2005 at 10:39 am
Using Query Analyzer,
Select Tools | Options | Results
check the "Output Query" checkbox.
March 2, 2005 at 11:18 am
Actually, his complaint was that it didn't interleave the query with the results. He had already tried that setting unsatisfactorily.
March 2, 2005 at 5:03 pm
This probably is a long shot. You can use DBCC INPUTBUFFER to print out your command at the end of each resultset.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply