FOR SESSION - Teradata Vantage - Analytics Database

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

The set of name:value pairs applies to the current session.

You can set a session query band concurrently with an existing transaction query band.

Session query bands are stored in DBC.SessionTbl and are recovered after a system reset. The system populates additional columns in DBC.SessionTbl for a trusted session and uses the information in these session proxy columns to recover a trusted session after a system reset.

The query band for the session remains in effect until the current session ends or until you issue a:
  • SET QUERY_BAND FOR SESSION request to reset the query band.
  • SET QUERY_BAND NONE FOR SESSION request.
You can use SET QUERY_BAND FOR SESSION:
  • In a macro definition, as the single request in the macro.
  • With Teradata Parallel Transporter.
You cannot use SET QUERY_BAND FOR SESSION in:
  • Multistatement requests.
  • SQL procedure definitions.

All reserved query bands associated with a load or unload utility should be set FOR SESSION to enable their operation across a restart. For more information about reserved query bands, see SET QUERY_BAND in Teradata Vantage™ - SQL Data Definition Language Detailed Topics, B035-1184 and Teradata Vantage™ - Teradata® Virtual Storage, B035-1179.

VOLATILE
The system does not update the queryband column of DBC.SessionTbl and the FOR SESSION request is equivalent to a FOR TRANSACTION request.
Use caution if you mix SET QUERY_BAND requests. For example, an application can set some name:value pairs FOR SESSION that are saved in DBC.SessionTbl. If you then add query band name:value pairs using the SET QUERY_BAND VOLATILE option, the query band in the DBC.SessionTbl will no longer match the current session query band. In this case, the system restores the query band saved in DBC.SessionTbl on a restart.