|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Query Analyser - output SQL commands to Results paneWith Query Analyser for SQL Server 2000, when I open a .SQL script and
execute it, the 'Messages' tab of the Results pane contains the results of executing the script, including any errors. How do configure QA or otherwise (e.g. by a command in the script), so that the each SQL command is also output to the Results pane before the result of that command? This would make it far easier to see debug scripts and determine immediately which statement caused an error. Thanks for any help. As far as I am aware, there is no such capability.
You could copy the SQL command and put it in a Print statement just before the execution. -- Show quoteArnie Rowland, Ph.D. Westwood Consulting, Inc Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous You can't help someone get up a hill without getting a little closer to the top yourself. - H. Norman Schwarzkopf "Johnny Williams" <REMOVEjohnwilliams_***@NOThotmail.com> wrote in message news:ei8j8c$8tk$1@news.freedom2surf.net... > With Query Analyser for SQL Server 2000, when I open a .SQL script and > execute it, the 'Messages' tab of the Results pane contains the results of > executing the script, including any errors. How do configure QA or > otherwise (e.g. by a command in the script), so that the each SQL command > is also output to the Results pane before the result of that command? > > This would make it far easier to see debug scripts and determine > immediately which statement caused an error. > > Thanks for any help. > OK, thanks. How do people debug SQL scripts then? Is there any sort of
debugger tool which can step through a script one statement at a time and see the results of that statement? thanks, JW Show quote "Arnie Rowland" <ar***@1568.com> wrote in message news:utJg54T$GHA.4704@TK2MSFTNGP04.phx.gbl... > As far as I am aware, there is no such capability. > > You could copy the SQL command and put it in a Print statement just before > the execution. > > -- > Arnie Rowland, Ph.D. > Westwood Consulting, Inc > > Most good judgment comes from experience. > Most experience comes from bad judgment. > - Anonymous > > You can't help someone get up a hill without getting a little closer to > the top yourself. > - H. Norman Schwarzkopf > > > "Johnny Williams" <REMOVEjohnwilliams_***@NOThotmail.com> wrote in message > news:ei8j8c$8tk$1@news.freedom2surf.net... >> With Query Analyser for SQL Server 2000, when I open a .SQL script and >> execute it, the 'Messages' tab of the Results pane contains the results >> of executing the script, including any errors. How do configure QA or >> otherwise (e.g. by a command in the script), so that the each SQL command >> is also output to the Results pane before the result of that command? >> >> This would make it far easier to see debug scripts and determine >> immediately which statement caused an error. >> >> Thanks for any help. >> > > > OK, thanks. How do people debug SQL scripts then? I typically use PRINT statements.I found too many issues and too much overhead/hassle using Query Analyzer's debugger, and just don't have it in my list of top 10 things to do during development. A Johnny Williams (REMOVEjohnwilliams_***@NOThotmail.com) writes:
> OK, thanks. How do people debug SQL scripts then? Is there any sort of You can wrap it in a stored procedure, and then use the T-SQL debugger.> debugger tool which can step through a script one statement at a time and > see the results of that statement? But unless you are running QA on the same machine on the server, it can be very difficult to get it to work, because there is a lot of red tape with firewalls, permissions etc to get it to work. Personally, I go the same road as Aaron: I use PRINT statments, or if there is a lot, select to a debug table. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx > Personally, I go the same road as Aaron: I use PRINT statments, or if Yes! Though I use this more for performance testing (e.g. when a stored > there is a lot, select to a debug table. procedure is taking 5 minutes, and I want to find out which step(s) take longest. > Personally, I go the same road as Aaron: I use PRINT statments, or if Yes! Though I use this more for performance testing (e.g. when a stored > there is a lot, select to a debug table. procedure is taking 5 minutes, and I want to find out which step(s) take longest. Ha! Found it.
Tools - Options - Results - tick 'Output query' If a .SQL script is run from the command line (not using osql etc. but another 3rd party tool), what SQL command do I put in the script to tell it to echo/log the commands? thanks. Show quote "Johnny Williams" <REMOVEjohnwilliams_***@NOThotmail.com> wrote in message news:ei8j8c$8tk$1@news.freedom2surf.net... > With Query Analyser for SQL Server 2000, when I open a .SQL script and > execute it, the 'Messages' tab of the Results pane contains the results of > executing the script, including any errors. How do configure QA or > otherwise (e.g. by a command in the script), so that the each SQL command > is also output to the Results pane before the result of that command? > > This would make it far easier to see debug scripts and determine > immediately which statement caused an error. > > Thanks for any help. > Scrap that, I was mistaken. It only seems to echo the start of the script
to the Results pane, not all the SQL commands. Show quote "Johnny Williams" <REMOVEjohnwilliams_***@NOThotmail.com> wrote in message news:ei8jog$997$1@news.freedom2surf.net... > Ha! Found it. > > Tools - Options - Results - tick 'Output query' > If a .SQL script is run from the command line (not using osql etc. but There is no such T-SQL command; therefore, it depends on the tool. Osql.exe, > another 3rd party tool), what SQL command do I put in the script to tell > it to echo/log the commands? which you mentioned, can echo the input. For other tools, is they do not have built-in such feature, you can trace the commands with SQL Profiler. |
|||||||||||||||||||||||