Query Analyzer Questions

  • 1) I would like to know how to configure Query Analyser so that feedback or confirmation of changes can be summed or combined?

    For instance I run a large update batch query and I get hundreds or thousands of (1 record changed etc...) scrolling by.

    How can I get combine all these feedback messages to get something like "500 records affected or changed" instead of

    the "1 records affected or changed" scrolling down 500 times?

    2) Is there an equivalent to the Describe command in Oracle in SQL Query Analyzer? In Oracle Describe<tablename> lists the properites of the table. I realize right clicking on the tablename and choosing Properties does this but I was wondering if there was a Query Analyzer command that did this as well. "Describe" is not in the books here.

    Thanks for any help you can provide regarding this issues.

  • One single update will tell you how many rows be affected in once.

    sp_help yourtablename / sp_columns / sp_helpindex etc. See BOL for more commands.

     

  • 1) Look at the @@ROWCOUNT variable.

    In you QA code add SET NOCOUNT ON to the begin. Delcare a variable of a large enough numeric type (most likely int will work), and Set = 0. Then on each loop right after insert, update or delete do SET variable = variable + @@ROWCOUNT.

    When done do a print or variable to see the total.

    2) sp_help <tablename>

    Hope that helps.

Viewing 3 posts - 1 through 2 (of 2 total)

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