How to do it...

  1. Connect to Teradata Database using SQLA or Studio.
  2. Execute the following statement to enable query band on the session:
/*enable query band*/SET QUERY_BAND = ‘QUERY=Test;ApplicationName=SQLA;’ FOR SESSION ;
  1. Now execute any query from SQLA; all the queries associated with the current session will now be executed under this query band: 
/*sample query*/Sel * from dbc.dbase
  1. Now you can retrieve all the queries under this query band from DBQL as follows:
/*Get queries under query band*/sel query band, querytext,sessionidfrom dbc.dbqlogtblwhere trim(query band) LIKE ‘%ApplicationName%’;

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.