Changing the Server for the Current Session - Basic Teradata Query
Basic Teradata Query Reference
Product
Basic Teradata Query
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-06-28
dita:mapPath
wmy1488824663431.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
psp1479308573013
Product Category
Teradata Tools and Utilities
Preface
Purpose
Audience
Prerequisites
Supported Releases
Revision History
Additional Information
Product Safety Information
Introduction to BTEQ
Overview of BTEQ
Environment
BTEQ Sessions
BTEQ Session Modes
Determining the Current Version of BTEQ
Windows
UNIX, Linux, and Apple OS X Systems
BTEQ Operation in the Teradata Client-Server Environment
BTEQ Communication
Mainframe-Attached Communication Diagram
Workstation-Attached Communication Diagram
BTEQ Process
Call-Level Interface
Teradata Director Program (TDP) (or MTDP)
Teradata Server
Operating Environments
BTEQ Input
Command Set
Session Controls
SQL Controls
File Controls
Sequence Controls
Format Controls
Diagnostic Controls
Starting and Exiting BTEQ
Obtaining System Access
System Access Requirements
Obtaining Client System Access
Obtaining Teradata Database System Access
Additional Teradata Database Privileges
Starting a BTEQ Session
Starting BTEQ
Encoding Controls for Unicode Sessions
Command Line Options
Automatic File Allocation
LOGON Command
Basic LOGON Command Elements
tdpid
userid
Password
acctid
Advanced LOGON Command Elements
Logging On to a Teradata Database
Logging On in Interactive Mode
Logging On in Batch Mode
Bypassing Logon Prompts
Successful Logon Message
Failed Logon Message
Retrying a Failed Logon Attempt
Basic and Advanced Logon Elements Diagram
Logging Off from the Teradata Database and Exiting BTEQ
LOGOFF Command
LOGOFF Example
EXIT and QUIT Commands
EXIT and QUIT Examples
Error Information Options
Changing Your Password
When Your Password Expires
Changing Your Expired Password
Changing Your Password at Any Time
Specifying a Different Teradata Server
System Default tdpid
Changing the tdpid
Changing the Server for a Single Logon
Changing the Server for the Current Session
Specifying Multiple Sessions
Maximum Number of Sessions in a Set
Setting the Number of Sessions
Getting Help
Syntax Conventions
Notes on Command Input
Using BTEQ
Teradata SQL Requests
Request Types
Single-Statement Example
Multi-Statement Example
Multi-Statement Processing
Terminating Semicolon Recognition
Continuing SQL
Example 1 – Continuing SQL
Example 2 – Continuing SQL
Negating a Request
Example – Negating Requests
Using Comments in a BTEQ Session
BTEQ Comment Elements
BTEQ Comment Example
Continuing BTEQ Comments
ANSI Comment Elements
ANSI Comment Example
Mixing Comments
Concatenating BTEQ Comments
Invalid Comments
Entering IPv4 and IPv6 Network Addresses
Example: Entering IPv4 and IPv6 Network Addresses
UNIX Signals
SIGTERM Handling
Example 1 – SIGTERM Handling
Example 2 – SIGTERM Handling
Example 3 – SIGKILL
Running BTEQ Batch Jobs
Running Under z/OS
Running Other Client Systems
Switching from Interactive to Batch Mode
Defining Batch Mode Files
File Types
Defining Input and Output Files for z/OS BTEQ
Defining Additional Files
Specifying a Standard Input File
Using a Here Document for Standard Input Files
Specifying a Standard Output File
Using the > or >> Characters to Specify Output Files
Specifying Output File Block Size
Specifying Output File Logical Record Length
Specifying an Import File
Specifying Files for User-Defined Functions
Workstation BTEQ
Mainframe BTEQ
Transferring Source or Include Files Using Mainframe BTEQ
Specifying an Export File
Specifying a Run File
Specifying a Standard Error Output File
Using the > or >> Characters to Specify Output Files in UNIX
Shell Output Stream Differences on SUN Systems
Using Scripts, Run Files, Macros, and Stored Procedures
Line Numbers in Files
Command Execution Order
Creating and Using Scripts
Creating a Script
Identifying the Script as the Standard Input File
Displaying Script Results
Omitting the Userid and Password from the Script File
Creating and Using Run Files
Creating a Run File
Identifying a Run File as a Valid ddname
Executing a Run File
Terminating a Run File
Displaying Run File Results
Revising Scripts and Run Files
Accessing the System Editor
Creating and Using Macros
Additional Database Privileges for Macros
Command Execution in Macros
Creating a Macro
Available Commands for Teradata SQL Macros
Macro Example – deptdisplay
Executing Macros
Including a Macro in a Script
Creating Reports with Macros
Macro Example – Department Information Report
Defining the ddname of the Export File
Running the Macro
Report Example
Command Execution Messages
Creating and Executing a Macro from a Script
Creating and Using Stored Procedures
Types of Stored Procedures
External Stored Procedures
SQL Stored Procedures
Command Execution
Creating or Replacing a SQL Stored Procedure
Executing Stored Procedures
Including a Stored Procedure in a Script
Command Execution Messages
Using the Script File
Status Value Keywords
Testing Status Values
Status Examples
Testing and Branching
Testing and Branching Commands
IF... THEN... Command Process
GOTO Command Process
Producing Conditional Messages
Using the REPEAT Command
Updating Rows Using a Single Request
Updating Rows Using Multiple Requests
Updating Rows by Importing a File
Using the REPEAT Command when Importing a File
Using the = Command When Importing a File
Using REPEAT with Multiple Sessions
Discarding Input and Abort Requests
Using the Break Key on Workstations
Single-Break
Double-Break
Triple-Break
Using the Break Key on z/OS
Single-Break
Interrupting User Input
Aborting Requests with the ABORT Command
Timing the ABORT Request
Restoring a Teradata Database After a Failed ABORT Request
Aborting a File Redirection
Entering Operating System Commands from a BTEQ Session
Entering UNIX Commands
Entering Windows Commands
Error Handling
Teradata Database Error Codes
Possible Data-Loss Conditions
BTEQ Return Codes
Error Severity Levels
Maximum Error Level
Stored Procedure Compilation
SPL Structure
SPL Response Mode
BTEQ Error Output Files
I/O Errors and Abends
Mainframe-Attached Clients
BTEQ Large File (LF) Support
OS Limitations
BTEQ Output
Formatting BTEQ Output
Inheriting Defaults
Viewing the Current Format Specifications
Specifying the Default Format Specifications
Changing Screen Width
Changing the Null Specification
Disabling the Echo Required Function
Disabling the Retry Function
When an SQL Statement Fails in Teradata Mode
Specifying Record or Indicator Mode
Numeric Overflow in Reports
Limiting the Amount of Display Data
Specifying the Report Format
Vertical Presentation
Horizontal Presentation
Deleting Duplicated Data
Inserting Blank Lines
Inserting a Line of Underline Characters
Specifying Page Breaks
Specifying Column Separations
Splitting Report Lines
Horizontal Presentation
Vertical Presentation
Specifying Side Titles
Specifying Headers and Footers
BTEQ Commands for Headers and Footers
Specifying Printer Formats
Specifying the Page Size
Specifying the Form Feed Character
WITH Clause Output
Sequence of Fields
Summary Title Accommodation
Title Phrases
Converting Screen Displays to Reports
Producing a Report
Changing the Command Sequence
Identifying the Input File
Creating an Output Log File
Printing the Report File
Resubmitting Output as Input
Submitting Output as Input
Specifying the Export File
Specifying REPORT Format
Retrieving Data from a Teradata Database
Retrieving Data in REPORT Format
Closing the Export File
Specifying the Import File
Resubmitting the Output Data
Field Mode Translation of Control Characters
BTEQ Commands
BTEQ Command Syntax
General Rules
Windows Only
Example – BTEQ Command Syntax
BTEQ Command Elements
Continuing a BTEQ Command
Syntax Variable Definitions
Default BTEQ Values
Specifying Default Values
Checking Default Values
Command Syntax Errors and Command Settings
BTEQ Command Descriptions
=
AUTOKEYRETRIEVE
COMPILE
DECIMALDIGITS
DEFAULTS
ECHOREQ
ENCRYPTION
ERRORLEVEL
ERRORONDBSWARNING
ERROROUT
EXIT or QUIT
EXITONDELAY
EXPORT
Suppressing Title Text and Titledashes in Exported REPORT Format Output
Data-Returning Responses in Record Mode
Character Constants Treated as Variable-Length Strings (Record Mode)
Data-Returning Responses in Field Mode
Exporting Large Data Objects
Closing the Export File
EXPORT and Mainframe-Attached Systems
Backdoor Exports
EXPORT Examples
EXPORTEJECT
FOLDLINE
FOOTING
FORMAT
FORMCHAR
FULLYEAR
GOTO
HANG
HEADING
HELP BTEQ
IF...THEN...
IMPORT
DATA and INDICDATA Keywords
Importing Large Data Objects
REPORT Keyword
VARTEXT Keyword
Opening and Closing Import Files
IMPORT Examples
INDICATORMODE
LABEL
LARGEDATAMODE
LOGMECH and LOGDATA
LOGOFF
LOGON
LOGONPROMPT
MAXERROR
MESSAGEOUT
NOTIFY
Building an Exit Module
UNIX Examples for NOTIFY
z/OS Examples for NOTIFY
Windows Examples for NOTIFY
NULL
OMIT
OS
PACK
PAGEBREAK
PAGELENGTH
QUIET
RECORDLENGTH
RECORDMODE
REMARK
REPEAT
REPEATSTOP
REPORTALIGN
RETCANCEL
RETLIMIT
RETRY
RTITLE
RUN
SEPARATOR
SESSION CHARSET
SESSION RESPBUFLEN
SESSION SQLFLAG
SESSION TRANSACTION
SESSION TWORESPBUFS
SESSIONS
SHOW
SHOW CONTROLS
SHOW ERRORMAP
SHOW VERSIONS
SIDETITLES
SKIPDOUBLE
SKIPLINE
STATEMENTINDEPENDENCE
SUPPRESS
TDP
TIMEMSG
TITLEDASHES
TMSMMSG
TRANSLATECTRLSTOSPACES
TRIMTRAILINGSPACES
TSO
UNDERLINE
WIDTH
How to Read Syntax Diagrams
Syntax Diagram Conventions
Notation Conventions
Paths
Continuation Links
Required Entries
Optional Entries
Strings
Abbreviations
Loops
Excerpts
Multiple Legitimate Phrases
Sample Syntax Diagram
Diagram Identifier
Sample Workforce Database Tables
Sample Workforce Database Tables
Table DDLs
DDL for the Employee Table
DDL for the Department Table
DDL for the Project Table
DDL for the Charges Table
Table Contents
Kanji, Chinese, Korean, Unicode Character Set Support
Kanji, Chinese, Korean, Unicode Character Set Support
Kanji Character Sets
Establishing the Kanji Character Set
Description of the Kanji Character Set
SESSION CHARSET Command
GRAPHIC, VARGRAPHIC and LONG VARGRAPHIC
Chinese and Korean Character Sets
Rules for Chinese and Korean Character Sets
Unicode Character Sets
Rules for Unicode Character Sets
Using BTEQWIN
What is BTEQWIN?
BTEQWIN Main Window
BTEQWIN Menus
Sessions Menu
Edit Menu
View Menu
Window Menu
Help Menu
Displaying Multibyte Characters
Glossary
abend
ASCII
Byte Order Mark (BOM)
Basic Teradata Query (BTEQ)
Call-Level Interface (CLI)
Call-Level Interface Version 2 (CLIv2)
client
client-server environment
DBA
Database computer (DBC)
Data Interchange Format (DIF)
DOS
FastExport utility
FastLoad utility
field mode
FIPS
gateway
I/O
indicator mode
Job Control Language (JCL)
LAN
LDO
macro
mainframe-attached
Micro Teradata Director Program (MTDP)
MultiLoad utility
multipart indicator mode
network
PDE
protocol
record mode
records
Relational Database Management System (RDBMS)
row
run file
script
session
stored procedure
Structured Query Language (SQL)
Teradata Director Program (TDP)
Teradata Director Program Identifier (TPDID)
Teradata SQL
Time Sharing Option (TSO)
unformatted records
Unicode
UTF-16
UTF-8
varbyte
varchar
vargraphic
workstation
Use the BTEQ TDP command to specify a different Teradata server for all logons within the current session:
.SET TDP tdpid
Entering the TDP command specifies the Teradata Database that BTEQ accesses for all logons during the current BTEQ session.