April 6, 2005 at 10:09 am
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
April 6, 2005 at 10:19 am
SET NOCOUNT ON|OFF
April 6, 2005 at 10:26 am
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?
April 6, 2005 at 10:47 am
Change from SELECT ... to PRINT. Of course this will only accept a single PRINT value thought.....
Good Hunting!
AJ Ahrens
webmaster@kritter.net
April 6, 2005 at 11:23 am
Could you show me an example with the query below?
SELECT COUNT(*) FROM PS_ACTN_REASON_TBL
April 6, 2005 at 11:58 am
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
April 6, 2005 at 4:56 pm
IF you do the following you will NOT get ---------
PRINT @Counter v. SELECT @Counter
Good Hunting!
AJ Ahrens
webmaster@kritter.net
April 7, 2005 at 2:15 pm
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