How to get the No of Records Inserted/Updated/Deleted from output of BTEQ if we have collect stats

Database

How to get the No of Records Inserted/Updated/Deleted from output of BTEQ if we have collect stats

How to get the No of Records Inserted/Updated/Deleted from output of BTEQ if we have collect stats

In My BTEQ I am having below statements in the same order

1.collect stats

2.Insert query

3.Update Query

 

with out collect stats query my process is running good. Since the output of collect stats is also similar to UPDATE I am getting incorrect output.

Is there anyway I can get the no of records affected by executing the query.

or How we can ignore/supress collect stats records affected.

 

 

  • bteq
  • Collect stats
  • Teradata BTEQ
1 REPLY

Re: How to get the No of Records Inserted/Updated/Deleted from output of BTEQ if we have collect sta

Hi,

 

When running a BTEQ script DML commands always return the number of rows 'affected' by the command.

 

In your example, the COLLECT STATS will not say how many rows 'affected' - because it is not a DML command.

The INSERT and UPDATE will always return the number of rows 'affected' (i.e. inserted or updated). This information will be available to you regardless of whether you have the 'collect stats' command in there or not.

 

This is fine if you simply wnat to look at the row counts. If you want to do some processing then that is a bit trickier. You have to write some code which wil parse the BTEQ output (i.e. a text file) and extract the relevant information. BTEQ does not make that information available to you in a file/variable anywhere.

 

Cheers,

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com