Modify query results

  • I would like to know how to turn off the query output lines when executed through a sql script. I know how to turn them off in Query Analyzer, but i need to run the batch script through Autosys. Is there a SET command or something like that? I need there to just be rows of numbers in the results so i can compare them with results from Oracle tables. Any info would be appreciated. thanks.

    Turn off the lines below:

    -----------

    297

    -----------

    29707

    -----------

    1

    -----------

    24275

  • SET NOCOUNT ON|OFF

  • Thanks for the reply. I have SET NOCOUNT ON in my script. The command only turns the (1 row(s) affected) on/off. Is there another command that you would know that might work?

  • Change from SELECT ... to PRINT.  Of course this will only accept a single PRINT value thought.....



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Could you show me an example with the query below?

    SELECT COUNT(*) FROM PS_ACTN_REASON_TBL

  • It looks like you have multiple select statements in your script.  If so, you will always have those header rows.  You might insert the count results into a table variable, like so:

    SET NOCOUNT ON

    declare @Counts TABLE (RowCounts int)

    INSERT INTO @Counts (RowCounts)

    SELECT COUNT(*) FROM ProgramConstants

    INSERT INTO @Counts (RowCounts)

    SELECT COUNT(*) FROM OCSEIntercepts

    SELECT * FROM @Counts

    The last select statement produces a result set:

    RowCounts  

    -----------

    527

    483930

    There is no "i" in team, but idiot has two.
  • IF you do the following you will NOT get ---------

    PRINT @Counter v. SELECT @Counter



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Thanks AJ Ahrens...My problem is fixed.

Viewing 8 posts - 1 through 7 (of 7 total)

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