You are on page 1of 256

What would you do if you knew?

Teradata Studio
User Guide
Release 16.00
B035-2041-126K
March 2017
The product or products described in this book are licensed products of Teradata Corporation or its affiliates.

Teradata, Applications-Within, Aster, BYNET, Claraview, DecisionCast, Gridscale, MyCommerce, QueryGrid, SQL-MapReduce, Teradata
Decision Experts, "Teradata Labs" logo, Teradata ServiceConnect, Teradata Source Experts, WebAnalyst, and Xkoto are trademarks or registered
trademarks of Teradata Corporation or its affiliates in the United States and other countries.
Adaptec and SCSISelect are trademarks or registered trademarks of Adaptec, Inc.
Amazon Web Services, AWS, [any other AWS Marks used in such materials] are trademarks of Amazon.com, Inc. or its affiliates in the United
States and/or other countries.
AMD Opteron and Opteron are trademarks of Advanced Micro Devices, Inc.
Apache, Apache Avro, Apache Hadoop, Apache Hive, Hadoop, and the yellow elephant logo are either registered trademarks or trademarks of the
Apache Software Foundation in the United States and/or other countries.
Apple, Mac, and OS X all are registered trademarks of Apple Inc.
Axeda is a registered trademark of Axeda Corporation. Axeda Agents, Axeda Applications, Axeda Policy Manager, Axeda Enterprise, Axeda Access,
Axeda Software Management, Axeda Service, Axeda ServiceLink, and Firewall-Friendly are trademarks and Maximum Results and Maximum
Support are servicemarks of Axeda Corporation.
CENTOS is a trademark of Red Hat, Inc., registered in the U.S. and other countries.
Cloudera, CDH, [any other Cloudera Marks used in such materials] are trademarks or registered trademarks of Cloudera Inc. in the United States,
and in jurisdictions throughout the world.
Data Domain, EMC, PowerPath, SRDF, and Symmetrix are registered trademarks of EMC Corporation.
GoldenGate is a trademark of Oracle.
Hewlett-Packard and HP are registered trademarks of Hewlett-Packard Company.
Hortonworks, the Hortonworks logo and other Hortonworks trademarks are trademarks of Hortonworks Inc. in the United States and other
countries.
Intel, Pentium, and XEON are registered trademarks of Intel Corporation.
IBM, CICS, RACF, Tivoli, and z/OS are registered trademarks of International Business Machines Corporation.
Linux is a registered trademark of Linus Torvalds.
LSI is a registered trademark of LSI Corporation.
Microsoft, Active Directory, Windows, Windows NT, and Windows Server are registered trademarks of Microsoft Corporation in the United States
and other countries.
NetVault is a trademark or registered trademark of Dell Inc. in the United States and/or other countries.
Novell and SUSE are registered trademarks of Novell, Inc., in the United States and other countries.
Oracle, Java, and Solaris are registered trademarks of Oracle and/or its affiliates.
QLogic and SANbox are trademarks or registered trademarks of QLogic Corporation.
Quantum and the Quantum logo are trademarks of Quantum Corporation, registered in the U.S.A. and other countries.
Red Hat is a trademark of Red Hat, Inc., registered in the U.S. and other countries. Used under license.
SAP is the trademark or registered trademark of SAP AG in Germany and in several other countries.
SAS and SAS/C are trademarks or registered trademarks of SAS Institute Inc.
Simba, the Simba logo, SimbaEngine, SimbaEngine C/S, SimbaExpress and SimbaLib are registered trademarks of Simba Technologies Inc.
SPARC is a registered trademark of SPARC International, Inc.
Symantec, NetBackup, and VERITAS are trademarks or registered trademarks of Symantec Corporation or its affiliates in the United States and
other countries.
Unicode is a registered trademark of Unicode, Inc. in the United States and other countries.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Other product and company names mentioned herein may be the trademarks of their respective owners.
The information contained in this document is provided on an "as-is" basis, without warranty of any kind, either
express or implied, including the implied warranties of merchantability, fitness for a particular purpose, or non-
infringement. Some jurisdictions do not allow the exclusion of implied warranties, so the above exclusion may not
apply to you. In no event will Teradata Corporation be liable for any indirect, direct, special, incidental, or
consequential damages, including lost profits or lost savings, even if expressly advised of the possibility of such
damages.
The information contained in this document may contain references or cross-references to features, functions, products, or services that are not
announced or available in your country. Such references do not imply that Teradata Corporation intends to announce such features, functions,
products, or services in your country. Please consult your local Teradata Corporation representative for those features, functions, products, or
services available in your country.
Information contained in this document may contain technical inaccuracies or typographical errors. Information may be changed or updated
without notice. Teradata Corporation may also make improvements or changes in the products or services described in this information at any time
without notice.
To maintain the quality of our products and services, we would like your comments on the accuracy, clarity, organization, and value of this
document. Please e-mail: teradata-books@lists.teradata.com
Any comments or materials (collectively referred to as "Feedback") sent to Teradata Corporation will be deemed non-confidential. Teradata
Corporation will have no obligation of any kind with respect to Feedback and will be free to use, reproduce, disclose, exhibit, display, transform,
create derivative works of, and distribute the Feedback and derivative works thereof without limitation on a royalty-free basis. Further, Teradata
Corporation will be free to use any ideas, concepts, know-how, or techniques contained in such Feedback for any purpose whatsoever, including
developing, manufacturing, or marketing products or services incorporating Feedback.
Copyright © 2016 - 2017 by Teradata. All Rights Reserved.
Table of Contents

Preface.................................................................................................................................................................13
Purpose.......................................................................................................................................................................... 13
Audience........................................................................................................................................................................13
Revision History...........................................................................................................................................................13
Additional Information...............................................................................................................................................13
Product Safety Information........................................................................................................................................ 14

Chapter 1:
Getting Started With Studio..................................................................................................15
About Teradata Studio................................................................................................................................................ 15
Launching the Workbench......................................................................................................................................... 15
Workbench................................................................................................................................................................... 15
Customizing the Display.................................................................................................................................16
Toolbars.............................................................................................................................................................16
Preferences........................................................................................................................................................ 16
Logging Preferences.............................................................................................................................18
Displaying the Teradata Log Console................................................................................... 18
Controlling Log Levels............................................................................................................ 19
Adding Logging Levels............................................................................................................ 19
Setting the Log File Location.................................................................................................. 19
Teradata Datatools Preferences..........................................................................................................19
JDBC Connection Properties............................................................................................................. 20
Perspectives...................................................................................................................................................................20
Query Development Perspective....................................................................................................................20
Data Transfer Perspective............................................................................................................................... 21
Administration Perspective............................................................................................................................ 22
Navigator...............................................................................................................................................22
Object List Viewer................................................................................................................................23
Filters..................................................................................................................................................... 24
Filtering the Object List Viewer............................................................................................. 24
Administration Forms.........................................................................................................................24
Setting Root in the Administrative Perspective............................................................................... 25
Views..............................................................................................................................................................................25
Opening Views................................................................................................................................................. 26
Moving View Panels........................................................................................................................................ 26
Data Source Explorer.......................................................................................................................................26
Data Source Explorer Load Preferences............................................................................................27
Setting Data Source Explorer Load Preferences.............................................................................. 28
Setting Root in the Data Source Explorer.........................................................................................29

Teradata Studio User Guide, Release 16.00 3


Table of Contents

Chapter 2:
Database Connectivity.................................................................................................................. 31
About Connection Profiles......................................................................................................................................... 31
Maximum Connections per Profile Preference....................................................................................................... 32
Adding a New Driver Definition............................................................................................................................... 32
Teradata Database Connectivity................................................................................................................................ 33
Creating a Teradata Connection Profile....................................................................................................... 33
Kerberos Authentication.....................................................................................................................34
Adding a JDBC Property.................................................................................................................................34
Editing JDBC Connection Properties........................................................................................................... 35
Database Cache................................................................................................................................................ 35
QueryBand Preferences...................................................................................................................................36
Aster Database Connectivity...................................................................................................................................... 37
Creating an Aster Database Connection Profile..........................................................................................37
Creating an Aster Execution Engine Connection Profile...........................................................................38
Specify a Driver and Connection Details......................................................................................................39
Aster Connection Properties.......................................................................................................................... 41
Connecting to an Aster Database or Aster Execution Engine................................................................... 43
Disconnecting From Aster Database or Aster Execution Engine............................................................. 43
Deleting an Aster Connection Profile........................................................................................................... 43
Adding and Editing JDBC Connection Properties..................................................................................... 44
Changing the Aster User Password............................................................................................................... 44
Adding an Aster Database Driver Definition.............................................................................................. 44
New JDBC Property.............................................................................................................................45
Add a JDBC Property.......................................................................................................................... 45
About Caching Aster Schemas.......................................................................................................................46
Caching Aster Schemas....................................................................................................................... 46
Schema Cache Properties....................................................................................................................47
Editing Aster Cache Schema Properties........................................................................................... 47
About Refreshing Schema Cache.......................................................................................................48
Deleting Aster Cache Files.................................................................................................................. 48
Hadoop Connectivity.................................................................................................................................................. 48
Creating a Hadoop Generic System Connection Profile............................................................................48
Hadoop Cloudera Connection Profiles.........................................................................................................49
Creating Hadoop Cloudera Connection Profiles............................................................................ 50
Hadoop Hortonworks Connection Profiles................................................................................................. 52
Creating a Hortonworks Self-Signed Certificate............................................................................. 52
Creating Hadoop Hortonworks Connection Profiles.....................................................................53
Oracle, DB2, and SQL Server Connections.............................................................................................................. 55

Chapter 3:
Database Administration...........................................................................................................57
Teradata Database........................................................................................................................................................57
Database Object Management....................................................................................................................... 57
Viewing Database Objects.................................................................................................................. 57
Creating Database Objects..................................................................................................................57
Modifying Database Objects...............................................................................................................57
Dropping Database Objects................................................................................................................58

4 Teradata Studio User Guide, Release 16.00


Table of Contents

Foreign Server Administration...................................................................................................................... 58


Creating a Foreign Server................................................................................................................... 58
Altering Foreign Server Properties.................................................................................................... 60
Dropping a Foreign Server................................................................................................................. 61
Secure Zones Administration.........................................................................................................................61
Listing Secure Zones............................................................................................................................ 61
Creating a Secure Zone....................................................................................................................... 62
Dropping a Secure Zone..................................................................................................................... 62
Modifying a Secure Zone.................................................................................................................... 62
Adding Users to a Secure Zone.......................................................................................................... 63
Removing Users from a Secure Zone................................................................................................ 63
Adding Zone Guests to a Secure Zone..............................................................................................63
Removing Zone Guests From a Secure Zone................................................................................... 64
Database and User Management................................................................................................................... 64
Creating a Teradata Database or User.............................................................................................. 64
Viewing Teradata Database or User Properties...............................................................................64
Modifying Teradata Database or User Properties........................................................................... 64
Cloning a Teradata Database or User............................................................................................... 65
Table Management.......................................................................................................................................... 65
Adding a Teradata Table.....................................................................................................................65
Profile Management........................................................................................................................................ 66
Creating a Profile................................................................................................................................. 67
Viewing Profile Properties..................................................................................................................67
Modifying Profile Properties.............................................................................................................. 68
Privileges Modifications..................................................................................................................................68
Granting and Modifying Object-Level Privileges............................................................................68
Granting and Modifying System Privileges......................................................................................70
Trigger Management....................................................................................................................................... 71
Displaying Triggers in a Database..................................................................................................... 71
Creating a Trigger................................................................................................................................ 71
Enabling or Disabling a Trigger.........................................................................................................71
Viewing Trigger Properties.................................................................................................................72
Modifying Trigger Properties.............................................................................................................72
Roles Management...........................................................................................................................................72
Creating a Role..................................................................................................................................... 73
Viewing Role Properties......................................................................................................................74
Modifying Role Properties..................................................................................................................74
Dataset Schemas............................................................................................................................................... 74
Viewing Dataset Schemas................................................................................................................... 75
Creating Dataset Schemas...................................................................................................................75
Dropping Dataset Schemas.................................................................................................................75
Authorization Management........................................................................................................................... 76
Creating an Authorization..................................................................................................................76
Viewing Authorization Properties.....................................................................................................76
Modifying Authorization Properties.................................................................................................76
View Management........................................................................................................................................... 77
Creating a View.................................................................................................................................... 77
Modifying a View.................................................................................................................................77
Dropping a View.................................................................................................................................. 78
Teradata Database Browsers...............................................................................................................78
Dependency Browser...............................................................................................................78

Teradata Studio User Guide, Release 16.00 5


Table of Contents

Interdependency Browser....................................................................................................... 79
Macro Management.........................................................................................................................................81
Creating a Macro..................................................................................................................................81
Dropping a Macro................................................................................................................................81
Stored Procedure Management......................................................................................................................82
Creating a Stored Procedure...............................................................................................................82
Dropping a Stored Procedure.............................................................................................................82
User-Defined Function (UDF) Management.............................................................................................. 82
Creating a UDF.................................................................................................................................... 82
Dropping a UDF.................................................................................................................................. 83
User-Defined Type (UDT) Management..................................................................................................... 83
Creating an Array UDT...................................................................................................................... 83
Creating a Distinct UDT..................................................................................................................... 83
Creating a Structured UDT................................................................................................................ 84
Dropping a UDT.................................................................................................................................. 84
Rights Management.........................................................................................................................................84
Connect Through Rights.....................................................................................................................84
Permanent Proxy Users Tab...................................................................................................85
Application Proxy Users Tab................................................................................................. 86
Display Tab............................................................................................................................... 86
Revoke Tab................................................................................................................................86
SQL Preview Tab......................................................................................................................87
Logon Rights......................................................................................................................................... 87
Display Tab............................................................................................................................... 88
Revoke Tab................................................................................................................................88
Grant Tab.................................................................................................................................. 88
SQL Preview Tab......................................................................................................................89
Access Logging Rules...........................................................................................................................89
Display Access Logging Tab................................................................................................... 89
Set Access Logging Tab........................................................................................................... 89
Viewing Access Logging Rules............................................................................................... 91
Setting Access Logging Rules................................................................................................. 91
Query Logging Rules........................................................................................................................... 92
Display Query Logging Rules................................................................................................. 92
Set Query Logging Tab............................................................................................................ 92
Viewing Query Logging Rules................................................................................................94
Setting Query Logging Rules.................................................................................................. 94
Move Space....................................................................................................................................................... 95
Moving Spacing Between Databases and Users...............................................................................95
Object Space......................................................................................................................................................96
Data Tools......................................................................................................................................................... 96
Compare Objects..................................................................................................................................96
About Comparing Objects......................................................................................................96
About the Compare Editor..................................................................................................... 99
Statistics...........................................................................................................................................................101
Statistics Collection View..................................................................................................................101
Collect Statistics Wizard................................................................................................................... 103
Collecting Statistics............................................................................................................................105
Drop Statistics.....................................................................................................................................105
Dropping Statistics.............................................................................................................................106
Filter Operations................................................................................................................................ 106

6 Teradata Studio User Guide, Release 16.00


Table of Contents

Collect Statistics SQL Preview..........................................................................................................107


Aster Database............................................................................................................................................................107
Aster Databases and Privileges.....................................................................................................................107
Granted Privileges..............................................................................................................................107
Grantee Type and Privileges.............................................................................................................108
Aster Databases, Users, and Roles................................................................................................... 108
Aster Database Roles and Membership...................................................................................................... 108
Browsing Aster Schemas and Objects......................................................................................................... 109
Defining Databases on an Aster Server.......................................................................................................109
Creating an Aster Database.............................................................................................................. 109
Naming an Aster Database............................................................................................................... 110
Database Form....................................................................................................................................110
Dropping an Aster Database............................................................................................................ 110
Defining Aster Schemas................................................................................................................................ 111
Creating an Aster Schema.................................................................................................................111
Schema Form...................................................................................................................................... 111
Dropping an Aster Schema...............................................................................................................112
Defining Aster Database Users.................................................................................................................... 112
Creating an Aster Database User.....................................................................................................112
User Form........................................................................................................................................... 113
Dropping an Aster Database User...................................................................................................114
Defining Aster Roles......................................................................................................................................114
Creating an Aster Role...................................................................................................................... 114
Role Form............................................................................................................................................115
Dropping an Aster Role.................................................................................................................... 115
Defining Aster Tables....................................................................................................................................116
Aster Analytic Tables and Persistence............................................................................................ 116
Creating an Aster Table.................................................................................................................... 116
Table Form..........................................................................................................................................119
Dropping an Aster Table.................................................................................................................. 120
Aster Table Types...............................................................................................................................120
Defining Aster Views.....................................................................................................................................121
Creating an Aster View..................................................................................................................... 121
View Form.......................................................................................................................................... 121
Dropping an Aster View................................................................................................................... 122
DDL Management..................................................................................................................................................... 122
Showing DDL Statements.............................................................................................................................122
Data Definitions Generation........................................................................................................................ 123
Generate DDL Basics.........................................................................................................................123
Generating DDL for Database Objects........................................................................................... 123

Chapter 4:
Teradata Data Lab.............................................................................................................................125
About Data Lab.......................................................................................................................................................... 125
About the Data Lab View..........................................................................................................................................125
Opening the Data Lab View......................................................................................................................... 126
Copying Tables to Data Labs........................................................................................................................126
Data Lab Copy Wizard..............................................................................................................................................127
About the Data Lab Copy Wizard............................................................................................................... 127

Teradata Studio User Guide, Release 16.00 7


Table of Contents

About Copy Table..........................................................................................................................................127


About Filter Table..........................................................................................................................................128
About SQL Preview Filter Table.................................................................................................................. 129

Chapter 5:
Query Development........................................................................................................................ 131
Data Tools for Query Development........................................................................................................................131
Teradata SQL Editor..................................................................................................................................................131
About the SQL Editor....................................................................................................................................131
Using the SQL File Editor................................................................................................................. 132
Drag and Drop into SQL Editor...................................................................................................... 133
SQL Editor Preferences..................................................................................................................... 133
SQL Formatter Preferences.................................................................................................. 135
SQL Editor Toolbar........................................................................................................................... 136
SQL Handling.................................................................................................................................................138
BLOB Disposition.............................................................................................................................. 139
CLOB Disposition..............................................................................................................................140
LOB Disposition.................................................................................................................................140
Setting SQL Handling Preferences.................................................................................................. 141
Execute SQL....................................................................................................................................................142
Running SQL...................................................................................................................................... 142
Format SQL Command.................................................................................................................................143
Set Connection Information.........................................................................................................................143
SQL Editor Templates................................................................................................................................... 143
Retrieving Table Rows using a SELECT Template........................................................................143
Inserting Table Rows using an INSERT Template........................................................................144
Inserting Table Rows using Parameterized Queries..................................................................... 144
Parameterized Queries.......................................................................................................... 145
Updating Table Rows using an UPDATE Template.....................................................................146
Deleting Table Rows using a DELETE Template.......................................................................... 146
Inserting Aster Analytical Functions.............................................................................................. 147
About Teradata SQL Query Builder........................................................................................................................148
Result Set Viewer....................................................................................................................................................... 149
Result Set Viewer Preferences...................................................................................................................... 152
Setting Result Set Viewer Preferences.............................................................................................154
Results Preferences............................................................................................................................ 156
Formatting the Foreground in Selected Cells................................................................................ 157
Formatting the Background in Selected Cells................................................................................157
Java Simple Date Format...................................................................................................................157
SQL History View...................................................................................................................................................... 158
SQL History Form......................................................................................................................................... 158
About SQL History Form............................................................................................................................. 160
Toolbar for SQL History............................................................................................................................... 161
Cleanup History............................................................................................................................................. 162
Import History............................................................................................................................................... 162
Export History................................................................................................................................................163
Filtering with Data Filter...........................................................................................................................................163
History Preferences........................................................................................................................................163
Database Objects Search........................................................................................................................................... 165

8 Teradata Studio User Guide, Release 16.00


Table of Contents

Find Object..................................................................................................................................................... 165


Finding Objects.................................................................................................................................. 166
Advanced Find Objects................................................................................................................................. 167
Find Results.....................................................................................................................................................169
Enabling Teradata Unicode Pass-Through............................................................................................................ 169
Showing Table Row Counts..................................................................................................................................... 169

Chapter 6:
Table Data Development......................................................................................................... 171
About the Table Data Editor.................................................................................................................................... 171
Table Data Editor.......................................................................................................................................................172
Toolbar............................................................................................................................................................ 173
About Editing Large Data and Objects....................................................................................................... 175
About Paging Large Tables...........................................................................................................................175
Data Filter....................................................................................................................................................... 175
Opening the Table Data Editor....................................................................................................................176
Table Data Editor Preferences......................................................................................................................177
Setting Table Data Editor Preferences............................................................................................ 178
Table Data Editing..................................................................................................................................................... 178
About Editing Table Data............................................................................................................................. 178
Editing Table Data......................................................................................................................................... 178
Inserting Table Data...................................................................................................................................... 179
Displaying Column Data by Value..............................................................................................................179
Deleting Table Rows......................................................................................................................................180
Deleting Data from Cells...............................................................................................................................180
Reverting Edits............................................................................................................................................... 180
Finding and Replacing Data......................................................................................................................... 181
Find Replace........................................................................................................................................181
Selecting to Filter by Edits............................................................................................................................ 182
Viewing SQL Preview for Data Updates.....................................................................................................182
Large Data and Objects Editing............................................................................................................................... 183
About the Blob Editor................................................................................................................................... 183
Blob Editor.......................................................................................................................................... 183
Opening the Blob Editor................................................................................................................... 184
Editing BLOB Data............................................................................................................................ 185
About the Clob Editor................................................................................................................................... 185
Clob Editor..........................................................................................................................................187
Opening the Clob Editor...................................................................................................................187
Editing CLOB Data............................................................................................................................188
About the Large Binary Editor.....................................................................................................................188
Opening the Large Binary Editor.....................................................................................................189
Large Binary Editor............................................................................................................................190
Editing Large Binary Data................................................................................................................ 191
About the Large Text Editor.........................................................................................................................191
Large Text Editor............................................................................................................................... 193
Opening the Large Text Editor........................................................................................................ 193
Editing Large Text Data.................................................................................................................... 194
About the XML Data Type Editor............................................................................................................... 194
XML Editor......................................................................................................................................... 196

Teradata Studio User Guide, Release 16.00 9


Table of Contents

Opening the XML Editor.................................................................................................................. 196


Editing XML Data..............................................................................................................................197
Table Data Filtering................................................................................................................................................... 197
About Filtering Table Data...........................................................................................................................197
About the Data Filter.....................................................................................................................................198
Exporting Table Data................................................................................................................................................ 201

Chapter 7:
Data Transfer........................................................................................................................................... 203
About Transferring Data.......................................................................................................................................... 203
Transfer View................................................................................................................................................. 203
Transferring Data From Tables................................................................................................................... 204
Data Transfer Wizard................................................................................................................................................204
About the Data Transfer Wizard................................................................................................................. 204
Opening the Data Transfer Wizard.................................................................................................205
Working with Data Transfer Wizard.............................................................................................. 206
Transferring Teradata Database Data......................................................................................................... 208
Data Transfer to Teradata.................................................................................................................208
About Transfer Hadoop Table to Teradata Table............................................................. 208
Data Transfer From Teradata.......................................................................................................... 209
About Transferring a Teradata Table to a Hadoop Table................................................209
About Teradata to Hadoop Column Specification........................................................... 211
Transferring Aster Database Data............................................................................................................... 211
Data Transfer from Aster..................................................................................................................211
Exporting Data from Aster................................................................................................... 211
Data Transfer to Aster.......................................................................................................................213
Loading Data to an Aster Table........................................................................................... 213
About Transfer Hadoop Table to Aster..........................................................................................214
About Hadoop to Aster Column Specification..................................................................215
About Hadoop to Aster SQL Preview................................................................................. 216
Transferring Hadoop Data........................................................................................................................... 216
Data Transfer from Hadoop.............................................................................................................216
Data Transfer to Hadoop.................................................................................................................. 217
About Transfer Teradata Table to Hadoop........................................................................217
About Teradata to Hadoop Column Specification........................................................... 218
About Copying Teradata Objects............................................................................................................................ 218
Copying Objects Using the Data Transfer Wizard................................................................................... 219
Copying Table Data Between Teradata Databases....................................................................................220
Dropping Objects on Transfer View...........................................................................................................220
About Copy Table..........................................................................................................................................221
Copy Object Support..................................................................................................................................... 222
Copy Object Wizard.................................................................................................................................................. 223
About the Copy Object Wizard................................................................................................................... 223
About Filter Copy Column...........................................................................................................................224
About Column Specification........................................................................................................................225
Column Data Type............................................................................................................................ 226
About SQL Summary.................................................................................................................................... 228

10 Teradata Studio User Guide, Release 16.00


Table of Contents

Chapter 8:
Data Import and Export............................................................................................................229
Importing Data Into a Volatile Table......................................................................................................................229
Import and Load External Data (Teradata, Aster)................................................................................................229
About the Load Data Wizard (Teradata, Aster)........................................................................................ 229
Load Data Wizard (Teradata, Aster)...............................................................................................231
Loading Table Data from a File (Teradata, Aster)........................................................................ 232
About the Load Data Wizard and JDBC.................................................................................................... 233
Import and Load External Data (Hadoop).............................................................................................................234
About the Load Data Wizard (Hadoop).....................................................................................................234
Load Data Wizard (Hadoop)............................................................................................................235
Loading Table Data from a File (Hadoop)..................................................................................... 236
About Smart Load Wizard (Teradata, Aster)........................................................................................................ 237
Creating Tables with Smart Load (Teradata, Aster)................................................................................. 238
Editing Column Data Types (Teradata, Aster)..........................................................................................240
Smart Load Data Types for Teradata Tables..............................................................................................241
Smart Load Data Types for Aster Tables.................................................................................................... 242
About Smart Load Wizard (Hadoop)..................................................................................................................... 243
Creating Tables with Smart Load (Hadoop).............................................................................................. 245
Editing Column Data Types (Hadoop)...................................................................................................... 246
Smart Load Data Types for Hadoop Tables............................................................................................... 246
Export External Data................................................................................................................................................. 247
About the Export Data Wizard.................................................................................................................... 247
Exporting Table Data to an External File................................................................................................... 248
Transfer Progress View............................................................................................................................................. 248
About the Transfer Progress View.............................................................................................................. 248
Transfer Details.............................................................................................................................................. 250
Job Details....................................................................................................................................................... 250
Transfer History View...............................................................................................................................................251
About the Transfer History View................................................................................................................ 251
Transfer History Filter.................................................................................................................................. 253
Sort................................................................................................................................................................... 254

Chapter 9:
Troubleshooting................................................................................................................................... 255
Troubleshooting.........................................................................................................................................................255

Teradata Studio User Guide, Release 16.00 11


Table of Contents

12 Teradata Studio User Guide, Release 16.00


Preface

Purpose
The purpose of this guide is to assist SQL developers and database administrators in using the Teradata
Studio development environment.

Audience
This guide is intended for SQL developers and database administrators of Teradata Database, Teradata Aster
Database, and Hadoop systems.

Revision History
Date Version Description
March 2017 Release 16.00 Updated to reflect support for Teradata Aster Execution
Engine.
January 2017 Release 16.00 Updated to reflect support for Kerberos authentication for
Hadoop clusters.
December 2016 Release 16.00 Version 16.00 initial release

Additional Information
Additional information is available at Teradata Community at http://community.teradata.com.

Related Links

URL Description
https://tays.teradata.com Use Teradata At Your Service to access Orange Books, technical alerts,
and knowledge repositories, view and join forums, and download
software packages.
www.teradata.com External site for product, service, resource, support, and other customer
information.

Related Documents
See http://www.info.teradata.com for this and other documents.

Teradata Studio User Guide, Release 16.00 13


Preface
Product Safety Information

Title Publication ID
Teradata Studio, Studio Express, and Plug-in for Eclipse Installation B035-2037
Guide

Customer Education
Teradata Customer Education delivers training for your global workforce, including scheduled public
courses, customized on-site training, and web-based training. For information about the classes, schedules,
and the Teradata Certification Program, go to www.teradata.com/TEN/.

Product Safety Information


This document may contain information addressing product safety practices related to data or property
damage, identified by the word Notice. A notice indicates a situation which, if not avoided, could result in
damage to property, such as equipment or data, but not related to personal injury.

Example

Notice:
Improper use of the Reconfiguration utility can result in data loss.

14 Teradata Studio User Guide, Release 16.00


CHAPTER 1
Getting Started With Studio

About Teradata Studio


Teradata Studio is a client-based graphical interface for performing database administration, query
development, and management tasks on Teradata Databases, Teradata Aster Databases, and Hadoop
systems.
Teradata Studio is built on the Eclipse Rich Client Platform (RCP) which takes advantage of the RCP
framework for building and deploying native GUI applications. It extends the Eclipse Data Tools Platform
(DTP) to provide enhancements for accessing objects and data stored in Teradata-supported databases.
Teradata Studio supports the Teradata Unified Data Architecture (UDA) by integrating administration, data
management and transfer, and SQL query development across the Teradata, Aster, and Hadoop platforms.

Launching the Workbench


Prerequisite
This procedure assumes you have installed Studio. See Teradata Studio, Studio Express, and Plug-in for
Eclipse Installation Guide for Installation instructions.

1. To launch Teradata Studio on your computer:

Operating System To Launch


Linux a. Update your path variable to include the Teradata Studio directory.
b. Execute TeradataStudio.

Mac Execute (or double-click) Teradata Studio in the TeradataStudio directory.


Windows Double-click the Teradata Studio desktop icon shortcut.

Workbench
The initial display for Teradata Studio consists of a toolbar, navigation pane, and several view panes. The
views in your display depend on the Studio perspective currently selected.

Teradata Studio User Guide, Release 16.00 15


Chapter 1: Getting Started With Studio
Workbench

In new installations, the Administration perspective is selected by default.

Customizing the Display


You can move the view panels around the display area, as well as move sections of the toolbar. A closed view
can be re-displayed by selecting the view from the Windows > Show View menu. To reset the perspective
back to the default settings, select Window > Reset Perspective from the top-most toolbar.

Toolbars
Each view contains a toolbar that gives you quick access to functions and dialogs for creating, modifying,
and administering database objects.

Preferences
Modify preferences by selecting Window > Preferences or Teradata Studio > Preferences.
In the Preferences window, you can filter the information or navigate to the preference. Changes to
preferences are stored within your workspace.

Data Management Preferences

Preference Description
Connectivity Configures the connectivity Driver Definitions by adding, editing, removing,
or copying driver definitions
Label Decorations Specifies the display format for columns in the Data Source Explorer
SQL Development Option Description
General Specifies settings for database development

16 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Workbench

Preference Description

Option Description
SQL Editor Offers options for the SQL Editor for code assist,
connection behavior for SQL files, syntax colors, and
SQL templates
SQL Query Omits the current database/schema from the generated
Builder SQL statements of the SQL Query Builder
SQL Results View Offers options for displaying the results of SQL
Options statements

General Preferences

Preference Description
Appearance Customizes the display appearance by offering options for theme, color, font,
and label preferences
Compare/Patch Customizes the display when comparing text files
Content Types Enables you to associate editors with file types
Editors Customizes editor behaviors and functions and adds or removes the editors
and file types available in the Content Types preferences
Globalization Customizes global settings for Unicode and text/graphic support
Keys Customizes the keyboard bindings
Security Customizes the secure storage, which may be needed when configuring the
Teradata Metadata Service (MDS) web service login on Linux
Workspace Changes the text file encoding for the workspace

Help Preferences

Preference Description
Content Customizes the display of the help screens as well as configuring remote help
content.

Teradata Datatools Preferences

Preference Description
Teradata Datatools Sets query and size preferences for all Teradata datatools
Connection Options Sets connection preferences for connection profiles. Preferences include
maximum connections per profile. For Teradata connections, queryband
options allow you to specify user and metadata queryband settings, as well as
fastload/export options. In addition, you can specify default JDBC Connection
Options for Teradata and Aster connections.

Teradata Studio User Guide, Release 16.00 17


Chapter 1: Getting Started With Studio
Workbench

Preference Description
Data Source Explorer Sets preferences in the Data Source Explorer for display of database and user
Load object hierarchy and for load settings that determine which databases and user
objects to load
Data Utilities Specifies the root directory location and thresholds for disk cache and
maximum rows allowed for COMMIT transactions
Dependencies Sets preferences for accessing the Meta Data Services web service
Export Sets the preference to launch a native editor and customizes export options.
Select Write SQL and Result Status to the Export File to include the SQL and
result status when exporting.
History Sets the exclude options for the History database, maximum number of rows to
display, and which columns to show in the SQL History View
Logging Specifies your preferences for logging messages
New Profile Connection Sets which types of connection profiles to show as options in the New
Types Connection Profile dialog
Object List Viewer Specifies which toolbars and menu actions are visible on the Object List Viewer
Result Set Viewer Sets preferences for Teradata Result Set Viewer.
SQL Formatter Sets preference options for the SQL Formatter.
SQL Handling Sets handling preferences for SQL result sets and options for drag-and-drop and
auto-connect functions. You can also specify the LOB sizes for handling large
values for Teradata and Aster, and customize success and failure notification as
sounds during SQL execution.
Studio Perspectives Sets options for opening perspectives.
Table Data Editor Sets preferences for selection color options, filter thresholds, and editor display
and copy/paste options.

Logging Preferences
Teradata error log messages are sent to teradata.log which is located by default in <user-profile>/
workspace-studio/.metadata/Teradata. They are also sent to the Teradata Log Console.
You can control the logging content in the log file and the Console independently. The Console is not a view
of the log file.

Displaying the Teradata Log Console


1. Select Window > Show Views > Other.
2. In the Show View window, select General > Console.
3. Click OK.
4. In the view, click the Open Console arrow, then select Teradata Log Console.

18 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Workbench
Controlling Log Levels
All levels of logging information go to the Teradata error log (teradata.log).
1. In the preferences, control the level of logging using the Console Display Logging Filter and Display
Exceptions in Console options.
These log options are typically set to INFO, but can be changed if you are instructed to do so by Teradata
Customer Support.
Select DEBUG under Datatools Logging Level to enable debug logging.

Adding Logging Levels


Turn on logging levels for more localized logging. For example, you can log debug messages for only the
com.teradata.datatools.dtp.catalog plug-in.
1. Click the New button to the right of the Loggers text area.
2. Type the name of the plug-in.
3. Select the name of the plug-in in the Loggers list, and choose the logging level.
4. Click Apply.

Setting the Log File Location


By default, the log file for Teradata Studio is located in <user-profile>/workspace-
studio/.metadata/Teradata. You can designate a different location where the log file is created and
maintained.
1. Click Window in the main menu and select Preferences.
2. Expand Teradata Datatools Preferences.
3. Click Logging Preferences.
4. Click Browse and navigate to the desired file location.
5. Click OK to close the Browse For Folder dialog.
6. Click OK to apply your changes and close the Result Set Viewer Preferences dialog.

Teradata Datatools Preferences


The Teradata Datatools Preference dialog lets you configure options that control the use of views to obtain
metadata information and to set the byte increments for display of size metrics.
The application uses system views to obtain information for its displays, such as the list of databases.
Typically the views are available in two forms: the V view and a VX view variant. Depending on your
permissions and how your database is set up, you may only be able to access the information through one
form.
Use the Teradata Datatools Preference to select the V, VX, or a Custom View to be used when loading the
metadata for various objects. If you select Custom Option, you must provide the fully-qualified name for a
table or view. Also, the table or view must provide the exact same column names and data types as the
associated DBC view. For example, if you are providing a custom view for the Databases list, you must
provide a fully-qualified name for a table or view that contains the same columns as DBC.DatabasesVX view.
At Size Preference, choose whether KB, MB, and GB increments are in multiples of 1000 or 1024.

Teradata Studio User Guide, Release 16.00 19


Chapter 1: Getting Started With Studio
Perspectives
JDBC Connection Properties
Under Preferences, under Connection Options, use the JDBC Connection Properties to define your default
JDBC connections.
For example, enter TMODE=TERA to set the system level default to Teradata or TMODE=ANSI to set the
system level default to ANSI.

Perspectives
Perspectives offer integrated environments for administrating databases, creating and issuing database
queries, and transferring data between databases.
As a default, Studio opens with the Administration, Query Development, and Data Transfer perspectives.
Move between them by clicking.

To open a perspective that isn't already open, select Window > Open Perspective and choose it from the
list.

Query Development Perspective


Use the Query Development Perspective to develop and run SQL queries.

The Query Development Perspective contains the following default views.


View Description
Data Source Explorer View and manage the database objects in the connected system.
Project Explorer A hierarchical view of the Projects and their resource files. Use Project
Explorer to select SQL files for editing or to create new SQL files.

20 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Perspectives

View Description
SQL Editor Develop, edit, test, and run SQL queries. It provides a Connection
Profiles option selecting the connection on which to execute the SQL
statements. Double-clicking a SQL file in the Project Explorer opens
the file in the SQL Editor.
Teradata Result Set Viewer View the result set, including options to hide columns, filter on
column values, copy data to clipboard, format cell data, and switch
between view modes. Each result set appears in a separate tab.
Teradata SQL History A list of SQL queries and their status, issued from the SQL editor,
allowing you to re-execute them.

Data Transfer Perspective


Use the Data Transfer Perspective to enable data transfers between Teradata Databases, Aster Databases,
and Hadoop file systems. The views enable a database administrator to perform tasks such as loading data
stored in Hadoop into a Teradata database and if desired, exporting the data to an external file or back to
Hadoop.

The Data Transfer Perspective contains the following default views:


View Description
Data Source Explorer View and manage the database objects in the connected system.
Transfer View In combination with the Data Source Explorer, transfer data from
one data system to another.
Transfer Progress Viewer View data transfer jobs and their status by displaying information
about the source and destination tables for the transfer, job name, and
start time, as well as the current elapsed time for the transfer operation.

Teradata Studio User Guide, Release 16.00 21


Chapter 1: Getting Started With Studio
Perspectives

View Description
Transfer History View View information about the data transfer event, such as the name, start
time, rows transferred, source and destination systems, status
(Completed, Canceled, or Failed), and summary.

Administration Perspective
Use the Administration Perspective to perform database administration tasks. This perspective allows you
to create, view, modify, and administer database objects, create new database users, and manage database
privileges and space.

The Administration Perspective contains the following default views:


View Description
Navigator View and manage the database objects in the connected system.
Filters Apply filters to the objects in the Object List Viewer.
Object List Viewer View detailed information about database objects in the Navigator
and perform administrative tasks.

Select Window > Show View to open additional views.

Navigator
Within the Administration perspective, the Navigator view contains the database object tree display. It is
similar to the Data Source Explorer view in other perspectives. The Navigator displays objects in the Object
List Viewer, allowing you to view, create, and modify objects, as well as perform other administrative tasks.

22 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Perspectives

The object categories vary depending on the type of connection. Right-click an option in the tree to list its
objects in the Object List Viewer. The double-click action is indicated by a check.

Object List Viewer


The Object List Viewer displays a list of objects of a particular type. As a default, it displays on the
Administration perspective.

Use the Filters view to filter the objects on the Object List Viewer.
The objects displayed vary depending on the type of connection and the selection in the Navigator.
Breadcrumbs at the top illustrate your path. Right-click an object in the viewer to see the available
commands. The double-click action is indicated by a check. Use these commands, as well as the toolbar
icons, to manage the objects in the view.
Use the Preferences page to configure the shown Object List Viewer options.

Teradata Studio User Guide, Release 16.00 23


Chapter 1: Getting Started With Studio
Perspectives
Filters
The Filters view filters the list of objects displayed in the Navigator and Object List Viewer for particular
object types.

Use the buttons in the toolbar to add, modify, or remove a filter. You can also copy a filter to the clipboard,
then past it into the Filter view for a different connection.

Filtering the Object List Viewer


This task assumes you are on the Administration perspective.

1. In the Filters view, click to add a filter.


2. Check Apply.
3. Complete the remaining fields in the filter.
Field Description
Filter Name Type a descriptive name for the new filter.
Category Select the type of category that you want to filter.
Case Insensitive Check this box to make the filter sensitive to the case of the filter
value.
Property Select the property to be used for the filter definition.
Operator Select the operator for the property's value.
Value Type the value for the filter expression.
AND/OR Select AND or OR to define multiple filters to be used at the same
time. To apply multiple filters, combine the AND filters using AND
and combine the OR filters using OR. Use AND to combine both the
AND and OR filters.
4. Click Add.
5. Refresh the view to see the change.

Administration Forms
In the Administration perspective, forms display detailed information about the selection on the Object List
Viewer. When you perform an action in the Object List Viewer, forms appear as tabs in the perspective.
For example, if you open or edit a database, the activity displays in a tabbed form.

24 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Views

For edit operations, use the form to perform the action on the object. Click Commit when finished.
The available forms vary between Teradata and Aster databases, as appropriate. There are no forms for
Hadoop file systems.
You can move the forms around the Details area. For example, you can arrange them side-by-side for
comparisons.
You can modify privileges for any object type that has them.

Setting Root in the Administrative Perspective


1. In the Administrative perspective, right-click the Databases folder in the Navigator.
2. Select Teradata > Set Root.
The Set Root Database for Navigator dialog appears.
3. In Root, type the name of the root database to load and display in the Navigator hierarchical tree display.
4. Click OK.
The database root displays in brackets in the Databases folder.

Views
The system provides multiple views and tools that allow you to explore, discover, and manage Teradata-
supported databases, to develop and execute SQL queries, and to transfer data between databases.
Many of the views appear as tabbed panes in the perspective. Not every view applies to every perspective.
This table shows the more commonly-used views in the system. Some views are explained in more detail
below.

View Description
Navigator Contains the database object tree display in the Administration
perspective.
Data Source Explorer Contains the database object tree display in the Query Development
and Data Transfer perspectives. You can create Connection Profiles
to your Teradata Database systems and interact with database objects.
Project Explorer Provides a hierarchical view of the Projects and their resource files.
You can select SQL files for editing or create new SQL files.

Teradata Studio User Guide, Release 16.00 25


Chapter 1: Getting Started With Studio
Views

View Description
Object List Viewer Displays a list of objects in a database. The right-click menu changes
depending on the kind of objects in the viewer.
Details/Forms Displays specific details for the selected database object and allows
them to be created or modified
Filters Filters the list of objects in the Object List Viewer
Data Lab Provides access to your tables from a Teradata Data Lab.
SQL Editor Displays when an SQL file is opened. Initially, the SQL Editor is
opened to provide an area to enter SQL statements. Double-clicking a
file in the Project Explorer causes the file to be opened in the SQL
Editor view.
Teradata SQL History Maintains a list of SQL queries issued from the SQL editor, allowing
you to re-execute them.
Teradata Result Set Viewer Displays the result set returned by SQL queries issued from the SQL
Editor view. Individual Result Set tabs are created for each result set.
If a CALL to a stored procedure that has OUT or INOUT parameters
is run, a tab is shown in the Result Set Viewer that contains the output
values of the parameters.
Transfer History Provides a display of the Data Transfer History information in the
database. When a data transfer completes, an entry is placed in the
Transfer History.
Transfer Progress Displays a list of executing data transfer jobs and their status.

Opening Views
1. In the main menu bar, select Window > Show View.
2. Select a view in the list or click Other to display additional views in the Show View dialog.
Your current perspective determines which views you can select.
The view you select displays in the workbench.

Moving View Panels


You can customize the look and feel of the interface by moving view panels within the display window.
Move a view by dragging it to a new location. You can also drag the view outside the display area, detaching
it.

Data Source Explorer


The Data Source Explorer supports SQL development and execution, as well as data transfers.
The Data Source Explorer is available in the Query Development perspective and Data Transfer
perspective.

26 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Views
Data Source Explorer Load Preferences
The Data Source Explorer Load Preferences enable you to configure your preference settings for loading
database and user objects and to determine what folders are shown in the Data Source Explorer
hierarchical tree display. You can set preferences to:
• Load databases and users:
∘ All databases and all users
∘ Load only databases and certain users
∘ Load all databases and users with PermSpace configured
• Configure the hierarchical display to show:
∘ All databases and all users
∘ Only certain folders you specify
• Whether to load object details for:
∘ Table space and journals
∘ Column data types in views.
• Whether filters created for folders in the Data Source Explorer should be case-insensitive. The default is
for filters to be case-sensitive. Check the option if you want filters to be case-insensitive.

What to Load
Use radio buttons in this section to set preferences for which objects you want loaded to the Data Source
Explorer view.

Option Description
All Databases and Users Loads all database and user objects for the connected database. Option
selected by default.
Only Databases (but include DBC Loads all databases and the DBC user, but no other user objects.
user)
Only Databases (but include DBC Loads all databases, the DBC user, and the current user.
user and myself)
Databases and Users with Loads all databases and users with PermSpace configured.
PermSpace
User Choice (includes DBC) Enables user to select only folders they want displayed in the Data
Source Explorer tree hierarchy. If all boxes are checked in What to
Display (default), this option is not available.

What to Display
Use the check boxes in this section to set preferences for which folders you want shown in the Data Source
Explorer hierarchical tree display.

Option Description
Show Databases and Users in Displays database and user objects in an expandable hierarchical view.
Hierarchical Display Option selected by default.
Include Database Indexes Folder Displays index objects in the Indexes folder. Option selected by
default.

Teradata Studio User Guide, Release 16.00 27


Chapter 1: Getting Started With Studio
Views

Option Description
Include Macros Folder Displays macro objects in the Macros folder. Option selected by
default.
Include Stored Procedures Folder Displays stored procedures objects in the Stored Procedures folder.
Include Tables Folder Displays table objects in the Tables folder. Option selected by default.
Include User-Defined Functions Displays user-defined function (UDF) objects in the User-Defined
Folder Functions folder. Option selected by default.
Include User-Defined Types Displays user-defined type (UDT) objects in the User-Defined Types
Folder folder. Option selected by default.
Include Views Folder Displays view objects in the Views folder. Option selected by default.

Load Object Details


Select the object details to include when loading objects in the Data Source Explorer. All object details are
selected by default.

Option Description
Load Tables space and journal details If selected, when table information loads in Data Source
Explorer, the space and journaling data is included. Option
selected by default.
Load View Columns Data Types If selected, when view information loads in Data Source
Explorer, column data types are included. Option selected by
default.

Setting Data Source Explorer Load Preferences


Use Data Source Explorer Load Preferences to configure your preference settings for loading database and
user objects in Data Source Explorer (DSE). You can also set preferences to determine what folders are
shown in the hierarchical display.
1. Click Window in the top menu and select Preferences.
2. Expand Teradata Datatools Preferences.
3. Select Data Source Explorer Load Preferences.
4. Under Load options for the Data Source Explorer What to load, select the objects to load:

Option Description
All Databases and Users Loads all database and user objects for the connected
database. Option selected by default.
Only Databases (but include DBC Loads all databases and the DBC user, but no other user
user) objects.
Only Databases (but include DBC Loads all databases, the DBC user, and the current user.
user and myself)
Databases and Users with Loads all databases and users with PermSpace configured.
PermSpace

28 Teradata Studio User Guide, Release 16.00


Chapter 1: Getting Started With Studio
Views
5. Under What to display, select the folders to show:

Option Description
Show Databases and Users in Displays database and user objects in an expandable hierarchical
Hierarchical Display view. Option selected by default.
Include Database Indexes Displays index objects in the Indexes folder. Option selected by
Folder default.
Include Macros Folder Displays macro objects in the Macros folder. Option selected by
default.
Include Stored Procedures Displays stored procedures objects in the Stored Procedures
Folder folder.
Include Tables Folder Displays table objects in the Tables folder. Option selected by
default.
Include User-Defined Displays user-defined function (UDF) objects in the User-Defined
Functions Folder Functions folder. Option selected by default.
Include User-Defined Types Displays user-defined type (UDT) objects in the User-Defined
Folder Types folder. Option selected by default.
Include Views Folder Displays view objects in the Views folder. Option selected by
default.
6. [Optional] To select all options to display, click Select All.
7. [Optional] To clear your selections, click Clear All.
8. In Load Object Details, select one or both of the following options:

Option Description
Load Tables space and If selected, when table information loads in Data Source Explorer, the
journal details load operation includes the space and journaling data. This option is
selected by default.
Load View Columns If selected, when view information loads in Data Source Explorer, the
Data Types load operation includes the column data types. This option is selected by
default.
9. [Optional] To reset and restore default selections, click Restore Defaults.
10. To apply your changes, click Apply.
11. Click OK to apply your changes and close the preference dialog.
The database and user folders in the Data Source Explorer refresh to reflect the settings you selected.

Setting Root in the Data Source Explorer


This feature is available for Teradata Databases displayed in the Data Source Explorer. In the Data Source
Explorer Load Preferences, be sure you select the Show Databases and Users in Hierarchical Display
check box to display databases.
1. Right-click the Databases folder.
2. Select Teradata > Set Root Database for DSE.
The Set Root Database for DSEdialog appears.

Teradata Studio User Guide, Release 16.00 29


Chapter 1: Getting Started With Studio
Views
3. In Root, type the name of the root database to load and display in the Data Source Explorer hierarchical
tree display.
4. Click OK.
The database root displays in parenthesis in the Databases folder name.

Note:
The SYSUDTLIB database always shows in the list of databases.

30 Teradata Studio User Guide, Release 16.00


CHAPTER 2
Database Connectivity

About Connection Profiles


A connection profile contains the connection property information needed to connect to a data source in
your enterprise.
You can create the following types of connection profiles. Those marked default are the default options in
the system.

Option Description
Aster Database Connects to Teradata Aster Database using the Aster
Embedded JDBC Driver (default).
Aster Execution Engine (Aster-on-Hadoop) Connects to a Teradata Aster Execution Engine instance
using the Aster AX Embedded JDBC Driver (default).
DB2 for Linux, UNIX, and Windows Connects to IBM DB2 database for Linux, UNIX, or
Windows, also known as DB2 LUW.
DB2 for i5/OS Connects to IBM DB2 embedded in the i5/OS operating
system for IBM System i (iSeries) formerly AS/400.
DB2 for z/OS Connects to IBM DB2 for z/OS for IBM mainframe systems.
Generic JDBC Connects using a JDBC database connection.
Hadoop Cloudera Connects to Hadoop Cloudera systems using these user-
defined options (defaults):
• Teradata Connection to Hadoop (TDCH) for Teradata
data transfer
• SQL-H for Hadoop to Aster data transfer
• Smart Loader for external file import and export in
Hadoop
• Hive Impala JDBC for creating and running SQL
• Presto JDBC for creating and running SQL

Hadoop Generic System Connects to open source Hadoop systems using the
WebHDFS service (default).
Hadoop Hortonworks Connects to Hortonworks Hadoop systems using these
user-defined options (defaults):
• Knox Gateway
• Teradata Connection to Hadoop (TDCH) for Teradata
data transfer
• SQL-H for Hadoop to Aster data transfer

Teradata Studio User Guide, Release 16.00 31


Chapter 2: Database Connectivity
Maximum Connections per Profile Preference

Option Description

• Smart Loader for external file import and export in


Hadoop
• Hive JDBC for creating and running SQL
• Presto JDBC for creating and running SQL

Oracle Connects to an Oracle database.


SQL Server Connects to a Microsoft SQL Server.
Teradata Database Connects to Teradata Databases using the Teradata
Embedded JDBC Driver (default).

Maximum Connections per Profile Preference


This option sets the maximum number of connections allowed per connection profile. This preference
applies to Teradata, Aster, and Hadoop (JDBC-enabled) connection profiles. When you are using the
maximum number of connections and you try a new SQL operation, a pop-up window reports that you've
reached the maximum number of allowable connections.

Adding a New Driver Definition


When you create a new connection profile for a connection that uses JDBC, a default driver definition for an
embedded driver is automatically selected. You can add a new driver definition for an external JDBC driver
when you first create the profile in the Connection Profile wizard or using the Properties dialog box for an
existing connection profile.
1. Do one of the following, depending on whether you are creating a new connection profile or modifying
an existing one:

Option Action
Creating a new In the New Connection Profile wizard, navigate to the Specify a Driver
connection profile and Connection Details step for a Teradata or Aster connection or the
JDBC Connection Properties step for a Hadoop connection.
Modifying an existing a. In the Data Source Explorer, right-click the connection name and
Aster connection profile select Properties.
b. Select Aster Database Connection Properties.

Modifying an existing a. In the Data Source Explorer, right-click the connection name and
Hadoop connection select Properties.
profile b. Select Hadoop System Connection Properties.
c. Select the JDBC tab.

32 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Teradata Database Connectivity
Option Action
Modifying an existing a. In the Data Source Explorer, right-click the connection name and
Teradata connection select Properties.
profile b. Select Teradata JDBC Connection Properties.

2. Click next to Select a driver from the drop-down.


a) Select the External JDBC Driver template for your system type.
b) In Driver name, enter a unique name for the driver definition.
c) On the JAR List tab, add the list of JDBC driver JARs.
To locate your Teradata JDBC driver JAR files on the file system, click Add Jar/Zip.
d) On the Properties tab, edit the JDBC driver properties.
e) Click OK to save the new driver definition.
The new driver is listed in the Select a driver from the drop-down list.

Teradata Database Connectivity

Creating a Teradata Connection Profile


The Connection Profile contains the JDBC information required to connect to an instance of a Teradata
Database.
1. In the Data Source Explorer or Navigator, click to create a new connection.
2. Select Teradata from Connection Profile Types.
3. At Name, type a name to identify the connection profile.
4. [Optional] At Description, type a description of the connection profile.
5. Click Next.
6. Select a driver from Select a driver from the drop-down.
The Teradata Embedded JDBC Driver template is selected as the default JDBC driver template. If you
need to create a new Teradata JDBC driver template, click .
7. At Database Server Name, type the host name running the Teradata Database.
8. At User Name[Domain], type the user name for the connection.
If you are connecting through Kerberos authentication, include the Domain name.
9. At Password, type the password for the connection.
10. If you are using advanced authentication, such as LDAP or Kerberos, select the Authentication
Mechanism. TDNEGO is also supported.
If you did not choose LDAP, Kerberos, or TDNEGO, the default protected logon is used.
11. [Optional] Set the Database if your connection requires that a default database be set at logon.
12. Select Save Password to save the password.
The password is valid for the workbench session.
13. In JDBC Connection Properties, accept the default properties or add and remove JDBC connection
properties to specify the connection details for the profile.

Teradata Studio User Guide, Release 16.00 33


Chapter 2: Database Connectivity
Teradata Database Connectivity
The default JDBC connection properties include a QueryBand string that contains query band name
value pairs (separated by semicolons) for a session.
14. [Optional] Click Cache Properties to open the Database Cache Properties dialog and select the
databases to cache.
15. [Optional] Click Delete Cache Files and confirm to delete cache files.
16. Specify when to connect:

Option Description
Connect when the wizard completes Connect to the database when you complete the profile.
Connect every time the workbench is Connect to this database each time you launch the
started workbench.
17. Click Next to view the Summary information.
18. Click Finish to create the connection profile.

Kerberos Authentication
When using Kerberos authentication, you must provide the TeraJDBC.config security configuration file
and specify its location in a Java property. The format of the TeraJDBC.config file is specified in the
Teradata JDBC Users Guide. Specify the location of this file in the
java.security.auth.login.configure property variable.
To add this property variable to the .ini file enter:
-Djava.security.auth.login.config=c:/TeraJDBC.config
where c:/TeraJDBC.config is the location of the TeraJDBC configuration file. The .ini file
(TeradataStudioExpress.ini, TeradataStudio.ini, or eclipse.ini) is located in the same
directory as the executable.
You must run kinit to initialize your Kerberos credential before launching the product.

Adding a JDBC Property


The Add JDBC Properties dialog displays when you add JDBC connection properties in the New Teradata
Connection Profile or Teradata JDBC Connection Properties dialog. JDBC connection properties are
defined by property value pairs.
1. In JDBC Properties on the Add JDBC Property dialog box, select a JDBC property from the drop-
down list.
You can also select QUERY_BAND as a property to specify the query bands for a session.
2. Select the value for the property in Select Property Value.
3. [Optional] if the property you select requires a user-defined value, enter the value in the Enter JDBC
Property Value dialog.
a) In the JDBC Property Value field, type a value for the property.
b) Click OK.
Also the Enter JDBC Property Value dialog displays if you click Click to enter value in the Select
Property Value field.
4. [Optional] To manually enter a JDBC property that is not in the properties list, select the property called
USER_ENTERED_PROPERTY and create a new property name value pair.

34 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Teradata Database Connectivity
a) In the New JDBC Property dialog, in Property Name, enter the name for the new JDBC property.
b) In Property Value, enter the value for the new JDBC property.
c) Click OK.
5. Click OK.
The JDBC property value pair is added to the JDBC Connection Properties.

Editing JDBC Connection Properties


You can add or remove connection properties to the list of JDBC Connection Properties.
1. Click Add to display a dialog with the list of JDBC properties.
2. Select the property you want to add.
To remove a property, select it and click Remove. To clear the entire list of connection properties click
Clear All.
3. From the list of Property Values, select the property value.
If the value requires user input, a dialog appears. Default connection properties are supplied for new
connection profiles. To override these defaults, click Save Properties. Future definitions use the saved
properties.
4. Type in a Property Value of no more than 30 characters.
5. Click OK to save the JDBC property.
If the property already exists in the list, a confirmation dialog appears.
6. Click OK to replace the JDBC property in the list.
7. Click Reset to Defaults to set the properties to the default values.
8. To cache schema, use metadataCache Properties.
You must enter a user name and password in order to configure the cache properties. To delete all
schema cache files for the connection profile, select Delete Cache Files
9. Repeat these steps to add multiple properties.
10. To test the connection, click Test Connection.
A message box appears stating the ping either succeeded or failed. Click OK to close the message box.
11. Select Connect every time the workbench is started to automatically connect to the database when
the application is started.
12. Click Finish to close the wizard and connect to your database.

Database Cache
The Database Cache option enables you to designate specific databases or users to be cached. A database
cache file is created to store the metadata for the database. The metadata describes information about the
database, such as its tables, columns, constraints, indexes, macros, parameters, stored procedures, user-
defined functions, user-defined types, views, and more. This metadata is used to populate the Data Source
Explorer and Transfer View trees.

Note:
The Database Cache option is associated with the Connection Profile. If the Connection Profile is
deleted, the Database Cache list and any database cache files that were created are also deleted.

Teradata Studio User Guide, Release 16.00 35


Chapter 2: Database Connectivity
Teradata Database Connectivity
Database Cache Inheritance
If the Data Source Explorer load option is set to show databases in hierarchical format, child databases and
user objects are nested under the parent database or user object. When you select a database or user object to
be cached, all of its child database and user objects are also cached. When you change the Data Source
Explorer load option, the database cache is deleted and then re-cached using the new selections.

Progress Monitor
When you first connect to the database and open the Databases folder, the database cache file is created in a
background job. To view the progress of the database cache job, open the Progress Monitor view by
selecting Window > Show View > Other > General > Progress and clicking OK.

About Refreshing Cache


After the cache is created, you can click Refresh to refresh the list of databases. Refreshing causes the cached
databases to load from the database cache file. You can distinguish the cached databases within the Data
Source Explorer tree by looking for the cache icon .
If new database objects are modified in the database while it is loaded from the database cache, the modified
objects do not display in the Data Source Explorer until you refresh the database cache. To refresh the
database cache for a specific database, right-click the cached database and select Refresh Database
Cache. This action deletes the database cache file, launches a new background job to create a new database
cache file, and refreshes the list of databases.
You can also refresh the database cache by deleting the database cache files in the Teradata JDBC
Connection Properties dialog. Click Delete Cache Files to delete the database cache files. The Data Source
Explorer shows any changes to the database objects. A subsequent refresh of the Databases folder loads the
database from the database cache file.

Termination of Cache Job


Terminating the database cache job causes the database cache files to be deleted and databases to be loaded
from the database metadata. To restart the database cache job, you must disconnect and reconnect the
Connection Profile, and then click the Databases folder to open it and create the database cache files.

QueryBand Preferences
User QueryBand Settings

Options Descriptions
Use User QueryBand Select this check box to enable the use of query bands for SQL Editor sessions. Use
this option to turn query bands on and off for SQL sessions.
User QueryBand Type the query band name value pairs you want available for a session. Separate
each query band name value pair with a semicolon (;) and enclose the statement
in single quotes ('). For example,
'ApplicationName=CDID;ClientUser=CS99934;'. The field provides a
sample query band string with variables you can complete.

36 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Aster Database Connectivity
Fast Load/Export QueryBand Settings

Options Descriptions
Use Fast Load/Export Select this check box to enable the use of query bands on fast load/export query
QueryBand Settings operations.
Fast Load QueryBand Type the query band name value pairs you want applied to the fast load/export
session. Separate each query band name value pair with a semicolon (;) and
enclose the statement in single quotes ('). For example,
'ApplicationName=CDID;ClientUser=CS99934;'. The field provides a
sample query band string with variables you can complete.

Metadata QueryBand Settings

Options Descriptions
Use Metadata Select this check box to enable the use of query bands when gathering metadata
QueryBand for the Data Source Explorer or Navigator tree.
Metadata QueryBand This editable field shows the metadata query band string used for the session
when the Use Metadata QueryBand check box is selected.

Aster Database Connectivity


An Aster Database connection profile defines the JDBC information required to connect to an instance of an
Aster Database on your system. It contains information such as the database server name, user name and
password required to establish the connection, port number, JDBC connection properties, and schema cache
properties.

Creating an Aster Database Connection Profile


1. In the Data Source Explorer or Navigator, click to create a new connection.
2. From Connection Profile Types, select Aster .
To filter the list of databases shown in Connection Profile Types, type a filter key (for example
Aster) to reduce the list to a subset of database types that match your filter criteria.
3. At Name, type a name to identify the connection profile.
4. [Optional] At Description, type a description of this Connection Profile.
5. Click Next.
6. Select Aster Database as the type of Aster database, and click Next.
7. Select a driver from Select a driver from the drop-down.
The Aster Embedded JDBC Driver template is selected as the default JDBC driver template. If you
need to create a new Aster JDBC driver template, click .
8. [Optional] Check Set Up SSO Connection to create a connection to an SSO-enabled Aster database
server.
9. At Database Server Name, type the host name running the Aster Database.
10. At User Name, type the user name for the connection.
11. At Password, type the password for the connection.

Teradata Studio User Guide, Release 16.00 37


Chapter 2: Database Connectivity
Aster Database Connectivity
12. Accept the default Port Number or type a different port number.
13. In Database Name, type the name of the database to which this profile connects.
Your connection requires that a default database be set when a user logs on. The default database for
Aster Database is beehive.
14. Select Save Password to save the password.
The password is valid for the workbench session.
15. If you selected Set Up SSO Connection:
a) Type the KDC required to connect to the database server.
b) Type the Domain Name required to connect to the database server.
c) Type the Service Name required to connect to the database server.
d) Click Browse and add the location of the JAAS Login Configuration file.
16. In JDBC Connection Properties, accept the default properties or add and remove JDBC connection
properties to specify the connection details for the profile.
17. [Optional] Click Cache Properties to open the Schema Cache Properties dialog and select the
schemas to cache.
18. [Optional] Click Delete Cache Files and confirm to delete cache files.
19. Specify when to connect :

Option Description
Connect when the wizard completes Connect to the database when you complete the profile.
Connect every time the workbench is Connect to this database each time you launch the
started workbench.
20. Click Next to view the Summary information.
21. Click Finish to create the connection profile.

Creating an Aster Execution Engine Connection Profile


1. In the Data Source Explorer or Navigator, click to create a new connection.
2. From Connection Profile Types, select Aster.
To filter the list of databases shown in Connection Profile Types, type a filter key (for example
Aster) to reduce the list to a subset of database types that match your filter criteria.
3. At Name, type a name to identify the connection profile.
4. [Optional] At Description, type a description of this Connection Profile.
5. Click Next.
6. Select Aster Execution Engine (Aster-on-Hadoop) as the type of Aster database, and click Next.
7. Select a driver from Select a driver from the drop-down.
The Aster AX Embedded JDBC Driver template is selected as the default JDBC driver template. If
you need to create a new Aster JDBC driver template, click .
8. [Optional] Check Set Up SSO Connection to create a connection to an SSO-enabled Aster database
server.
9. At Database Server Name, type the host name running the Aster instance.
10. At User Name, type the user name for the connection.
11. At Password, type the password for the connection.

38 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Aster Database Connectivity
12. Accept the default Port Number or type a different port number.
13. In Database Name, type the name of the database to which this profile connects.
Your connection requires that a default database be set when a user logs on. The default database for
Aster Database is beehive.
14. Select Save Password to save the password.
The password is valid for the workbench session.
15. If you selected Set Up SSO Connection:
a) Type the KDC required to connect to the database server.
b) Type the Domain Name required to connect to the database server.
c) Type the Service Name required to connect to the database server.
d) Click Browse and add the location of the JAAS Login Configuration file.
16. In JDBC Connection Properties, accept the default properties or add and remove JDBC connection
properties to specify the connection details for the profile.
17. [Optional] Click Cache Properties to open the Schema Cache Properties dialog and select the
schemas to cache.
18. [Optional] Click Delete Cache Files and confirm to delete cache files.
19. Specify when to connect:

Option Description
Connect when the wizard completes Connect to the Aster instance when you complete the
profile.
Connect every time the workbench is Connect to the Aster instance each time you launch the
started workbench.
20. Click Next to view the Summary information.
21. Click Finish to create the connection profile.

Specify a Driver and Connection Details


The Specify a Driver and Connection Details dialog enables you to specify the JDBC information required
to connect to an instance of an Aster Database or Aster Execution Engine. The dialog shows the connection
properties that define the Connection Profile.
Properties include:
• Database server name, port, and name of database to which to connect
• User name and password required to access the Aster Database or Aster Execution Engine instance
defined in the profile
• JDBC connection properties
• Options for caching database files and deleting cache files
• Options for opening the connection to the database

Connection Properties

Option Description
Select a driver from the drop- For an Aster Database connection, the Aster Embedded JDBC Driver
down Default template is selected as the default JDBC driver template. For

Teradata Studio User Guide, Release 16.00 39


Chapter 2: Database Connectivity
Aster Database Connectivity

Option Description
an Aster Execution Engine instance connection, the Aster AX
Embedded JDBC Driver Default template is selected as the default.
To create a new Aster JDBC driver template, click the asterisk button
( ) to add a driver definition.
Database Server Name Name of the database server that hosts the Aster Database or Aster
Execution Engine instance.
User Name Aster user name used to connect to the database server.
Password Password required to access the Aster Database or Aster Execution
Engine instance.
Port Number Port number to use for the Aster server.
Database Name Name of the default database. Your connection requires that a default
database be set when a user logs on.
Save Password Select the Save Password check box if you want the password saved.
If this option is not selected, you are required to enter a password each
time a connection to the database is made. The password you entered
in the Password field is valid for each workbench session and is not
affected by this check box.

JDBC Connection Properties


The JDBC Connection Profile list is blank until you add a property. Use the buttons on the right-side to
add, remove, clear, save, and reset properties in the list.

Property Actions
You can perform these actions for the JDBC connection properties you define.

Button Description
Add Add JDBC connection properties to the list of JDBC Connection
Properties.
Remove Remove properties from the list of JDBC Connection Properties by
selecting the property and clicking Remove. The property is
immediately removed from the list.
Clear All Click to clear the entire list of connection properties.
Save Properties Click to save the properties listed in the JDBC Connection Properties
list. The Save Properties feature overrides the default connection
properties supplied for a new connection profile, and saves the list you
created.
Reset to Defaults Click to set properties to the default values. If you have saved your
properties, and therefore, overridden the system defaults, the Save
Properties values are used as your default values.
Cache Properties Click to configure schema cache properties. This action opens the
Schema Cache Properties dialog. See Caching Aster Schemas.

40 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Aster Database Connectivity

Button Description
Delete Cache Files Click to delete cached files. See Deleting Aster Cache Files.

Connection Actions
You can verify that the information defined in the Connection Profile connects to the desired Aster
Database or Aster Execution Engine.

Option Description
Test Connection Click to test the connection. A message box appears stating the ping
either succeeded or failed. Click OK to close the message.
Connect when the wizard Select the check box if you want to connect to the database when you
completes click Finish.
Connect every time the Select the check box if you want to automatically connect to the
workbench is started database when the application is started.

Aster Connection Properties


The Aster Database Connection Properties and Aster AX Database Connection Properties dialogs
detail the JDBC information required to connect to an instance of an Aster Database or Aster Execution
Engine. The dialogs show the connection properties that make up the Connection Profile definition.
Properties include:
• Database server name, port, and name of database to which to connect
• User name and password required to access the Aster Database or Aster Execution Engine instance
defined in the profile
• JDBC connection properties
• Options for caching database files and deleting cache files
• Option to create an SSO (Single Sign On) connection and KDC (Key Distribution Center), domain name,
service name, and location of the JAAS (Java Authentication and Authorization Service) configuration
file required to access an SSO-enabled system.

Connection Properties

Option Description
Select a driver from the drop- The Aster Embedded JDBC Driver Default template is selected as
down the default JDBC driver template for an Aster Database connection,
and the Aster AX Embedded JDBC Driver Default template is
selected as the default for an Aster Execution Engine instance
connection.
Set Up SSO Connection Enables an SSO connection, which is disabled by default. Checking this
option disables the User Name and Password fields.
Database Server Name Name of the database server that hosts the Aster Database or Aster
Execution Engine instance.
User Name Aster user name used to connect to the database server.

Teradata Studio User Guide, Release 16.00 41


Chapter 2: Database Connectivity
Aster Database Connectivity

Option Description
Password Password required to access the Aster Database or Aster Execution
Engine instance defined in this Connection Profile.
Port Number Port number to use for the Aster server.
Database Name Name of the default database. Your connection requires that a default
database be set when a user logs on.
Save Password Saves a password.
If this option is not selected, you are required to enter a password each
time a connection to the database is made. The password you entered
in the Password field is valid for each workbench session and is not
affected by this check box.
KDC Key Distribution Center required to access an SSO-enabled Aster
database server. KDC is disabled by default and is enabled when Set
Up SSO Connection is checked.
Domain Name Domain name required to access an SSO-enabled Aster database
server. Domain name is disabled by default and is enabled when Set
Up SSO Connection is checked.
Service Name Service name required to access an SSO-enabled Aster database server.
Service name is disabled by default and is enabled when Set Up SSO
Connection is checked.
JAAS Login Configuration The location of the JAAS Login Configuration file required to access
an SSO-enabled Aster database server. JAAS Login Configuration is
disabled by default and is enabled when Set Up SSO Connection is
checked.

Note:
If you are connected to the Connection Profile and change the connection properties, when you click
OK, you are asked if you want to reconnect to the server.

JDBC Connection Properties


The JDBC Connection Profile list is blank until you add a property. Use the buttons on the right-side to
add, remove, clear, save, and reset properties in the list.

Property Actions
You can perform these actions for the JDBC connection properties you define.

Button Description
Add Adds a JDBC connection properties to the list of JDBC Connection
Properties.
Remove Removes properties from the list of JDBC Connection Properties.
Clear All Clears the entire list of connection properties.
Save Properties Saves the properties listed in the JDBC Connection Properties list.
The Save Properties feature overrides the default connection

42 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Aster Database Connectivity

Button Description
properties supplied for a new connection profile and saves the list you
created.
Reset to Defaults Sets properties to the default values. If you have saved your properties
and overridden the system defaults, the Save Properties values are
used as your default values.
Cache Properties Configures schema cache properties.
Delete Cache Files Deletes cached files.

Connection Actions
You can verify that the information defined in the Connection Profile results in a successful connection.

Option Description
Test Connection Tests the connection.

Connecting to an Aster Database or Aster Execution Engine


Connection profiles contain all the information required to securely connect to an Aster Database or Aster
Execution Engine server.
1. Open Data Source Explorer.
2. Right-click an Aster Database connection profile name.
3. Select Connect.
The Connection Properties dialog for Aster or Aster AX opens.
4. Verify the User Name.
5. Type the Aster Database user Password.
6. Click OK.
If the connection is successful, the Data Source Explorer displays the list of databases. If the connection is
not successful, an error "Problem Occurred" message displays. Click Details >> to view the error log or
click OK to close the message.

Disconnecting From Aster Database or Aster Execution Engine


You disconnect from an Aster server by using the connection profile options.
1. In Data Source Explorer, right-click the Aster connection profile of the Aster server from which to
disconnect.
2. Select Disconnect.
The Data Source Explorer pane refreshes, and the database list collapses to now display only the name of
the Aster connection profile.

Deleting an Aster Connection Profile


You delete a connection profile directly from the Data Source Explorer.

Teradata Studio User Guide, Release 16.00 43


Chapter 2: Database Connectivity
Aster Database Connectivity
1. Open Data Source Explorer.
2. Right-click the name of the connection profile you want to delete.
3. Select Delete.
4. Click Yes to confirm you want to delete the profile.
The Data Source Explorer refreshes and the connection profile name no longer displays in the folder
hierarchy.

Adding and Editing JDBC Connection Properties


You can add JDBC connection properties when you create or edit a connection profile. You also can edit
JDBC properties at any time from Data Source Explorer or Navigator. The Add button is located on the
right side of the JDBC Connection Properties display area.
1. In Aster Database Connection Properties, click Add.
The Add JDBC Property dialog displays a list of JDBC properties and values that you can add to the
connection profile.
2. Under JDBC Properties, select the property you want to add.
3. [Optional] To enter a JDBC property that is not listed, select USER_ENTERED_PROPERTY, and enter the
name and paired value.
The property value displays in the Select Property Value field as
<name_property>=<property_value>.
4. Click OK.
The new property value displays in JDBC Connection Properties.
5. Click Save Properties to save the JDBC property.

Note:
If the property already exists in the list, a confirmation dialog displays. Click OK to replace the JDBC
property in the list.
6. Repeat the above steps to add multiple properties.

Changing the Aster User Password


You can change the user password set in the Connection Profile for a connection to an Aster Database.
1. In Data Source Explorer, right-click an Aster Database name and select Aster > Change Password.
2. Type the current password.
3. Type the new password.
4. Retype the new password in the Confirm Password field.
5. Click OK.

Adding an Aster Database Driver Definition


When you create the Connection Profile for an Aster Database, you also can create a new driver definition
for that database.
1. Open the New Connection Profile wizard.
2. Select Aster from the list of Connection Profile Types and enter a Name for the connection profile.

44 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Aster Database Connectivity
3. [Optional] Type a Description.
4. Click Next.
5. To add a new driver definition, click .
a) Select the Aster External JDBC Driver template.
b) In Driver name, type a unique name for the driver definition.
c) On the JAR List tab, add the list of Aster JDBC Driver JARs.
To locate your Aster JDBC Driver JAR files on the file system, click Add Jar/Zip.
d) On the Properties tab, edit the JDBC driver properties.
e) Click OK to save your new Aster Driver definition and return to the New Aster Connection Profile
wizard.

New JDBC Property


Enter a valid JDBC property name and property value for the JDBC property/value pair. Property names and
values must not contain commas or equal signs.

New JDBC Property Name and Value

Option Description
Property Name Type the name of the property you want to add to the JDBC
Connection Properties list. The name must not exceed 30 characters.
Property Value Type the value for the property name. The value must not exceed 30
characters.

When you click OK, the property name and value you define display in the Select Property Value field in
the Add JDBC Property dialog in the format property_name = property_value.

Add a JDBC Property


You can add JDBC connection properties when you create a new Connection Profile. You can edit those
properties at any time by right-clicking the Connection Profile and selecting Properties.
To add a JDBC property, select the JDBC property you want to add and then select the property value. To
manually enter a JDBC property, select the JDBC property named USER_ENTERED_PROPERTY. In the New
JDBC Property dialog, enter a user-defined property name and value, and click OK.

JDBC Properties

Option Description
Select JDBC Property Select a property from the list. If you select
USDER_ENTERED_PROPERTY, the New JDBC Property dialog
displays in which you can type a new user-defined property name and
value. When you click OK, the property name and value you define
displays in the Select Property Value field in the format
property_name = property_value.
Select Property Value Select a JDBC property value from the list. Names must not exceed the
30 character limit. If no values are displayed in the list, you can select
USER_ENTERED_PROPERTY in the Select JDBC Property field and

Teradata Studio User Guide, Release 16.00 45


Chapter 2: Database Connectivity
Aster Database Connectivity

Option Description
create a user-defined name/value property pair in the New JDBC
Property dialog.

About Caching Aster Schemas


When working with Aster databases, you can designate specific schemas to be cached. Caching Aster
schemas creates a schema cache file that contains the metadata for the schema. The metadata describe the
schema tables, columns, constraints, indexes, mr functions, views, and so forth.
Cached schema are associated with a Connection Profile. If you delete the Connection Profile, the Schema
Cache list and any schema cache files associated with that Connection Profile are also deleted.
You can cache Aster schema and set cache properties when you:
• Create a new Connection Profile - Select cache schemas when you create a new Connection Profile using
the New Aster Connection Profile wizard. See Caching Aster Schemas.
• Edit existing cache schema list - Modify Aster cache properties from the Data Source Explorer. See
Editing Aster Cache Schema Properties.
Each cached Aster schema node in the Data Source Explorer is indicated by an icon.
When you connect to the Aster database and open the Schemas folder, a schema cache file is created in a
background job. You can view the progress of the schema cache job in the Progress Monitor view by
selecting Window > Show View > Other > General > Progress and click OK.

Note:
After you select schema to cache or edit cache and open the Schemas folder, the Serialization process
occurs. To complete the caching process, you must disconnect and reconnect to the Connection Profile.
You can open the Progress Monitor to view the serialization process.

Caching Aster Schemas


You can cache Aster schema and set cache properties when you create a new Connection Profile using the
New Aster Connection Profile wizard. Any schemas that you select in the Schema Cache Properties
dialog are cached. You can also modify Aster cache schema properties from the Data Source Explorer.
1. Create a Connection Profile for an Aster Database.
2. In the New Aster Connection Profile wizard select a driver and complete credentials for logging on to
the Aster database server.
3. Click Cache Properties on the first page of the wizard.
The Schema Cache Properties dialog opens.
4. [Optional] Under Cache Properties select the Cache Selected Schemas check box if you want to view
all available schemas for caching.
5. Confirm the connection to the database to get the list of schemas by clicking OK.
If the credentials for the Connection Profile are valid and the connection is successful, a list of the
schemas associated with the Connection Profile display in the Select Schema area.

Note:
If the credentials are not valid, an error message displays.

46 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Aster Database Connectivity
6. From the Select Schema list select one or more schema to cache by checking the box beside the schema
name.
7. Click OK.

Note:
If objects are modified in a cached schema, you must refresh the schema cache to cause the changes to
be reflected in the cache. To refresh schema cache, right-click the cached schema object in the Data
Source Explorer and select Refresh Schema Cache.

Schema Cache Properties


The Schema Cache Properties dialog enables you to select Aster schemas that you want cached.

Cache Properties Options


The following options require a valid set of credentials for connecting to the selected Aster schemas. You
provide credentials when you create a Connection Profile, and they are saved in the Connection definition.

Option Description
Cache Selected Schemas Opens a dialog that confirms you want to proceed with creating a
connection to collect a list of schemas.
Select Schema Lists the schemas associated with the Connection Profile display in this
text area if the credentials for the Connection Profile are valid and the
connection is successful.

Note:
If the credentials are not valid, an error message displays. To test
your connection, close the Schema Cache Properties dialog by
clicking Close, and click Test Connection.

Note:
If objects are modified in a cached schema, you must refresh the schema cache to cause the changes to be
reflected in the cache. To refresh schema cache, right-click the cached schema object in the Data Source
Explorer and select Refresh Schema Cache.

Editing Aster Cache Schema Properties


You can edit caching properties using the Schema Cache Properties dialog available from the Data Source
Explorer.
1. In the Data Source Explorer, right-click the Aster cached schema to be edited.
2. Select Properties.
The Schema Cache Properties dialog opens.
3. Select the schemas you want to cache using one of the following options:

Option Description
Single selection Selects an individual schema.
Select all Selects all schema names in the list.

Teradata Studio User Guide, Release 16.00 47


Chapter 2: Database Connectivity
Hadoop Connectivity
Option Description
Clear all Clears all schema names from the list.
4. Click OK.
5. If you are prompted with a message asking if you want to reconnect to the server, click OK.

About Refreshing Schema Cache


After you create schema cache files, if you refresh the list of schemas by clicking Refresh, the cached
schemas are loaded from the schema cache file. Cached schema are indicated in the Data Source Explorer
view with the cache icon .
If new database objects are modified in the schema while it is being loaded from the schema cache, the
modified objects do not appear in the Data Source Explorer until you refresh the schema cache.

To refresh the schema cache, right-click a cached schema and select Refresh Schema Cache. This deletes
the schema cache file, launches a new background job to create a new schema cache file, and refreshes the
list of schemas. You can also refresh the schema cache by deleting the schema cache files using the Aster
Database Connection Properties Delete Cache Files option and then reconnecting the Connection
Profile. The Data Source Explorer now shows the changes to the database objects. A subsequent refresh of
the Schemas folder loads the schema from the schema cache file.

Deleting Aster Cache Files


You can delete Aster cache files using the Delete Cache Files button in these dialogs:
• Aster Database Connection Profile wizard
• Aster Database Connection Properties
Deleting cache files does not disable the caching of Aster schemas. It only deletes the cache files that have
been generated. When you connect to the Connection Profile, the files are recreated to cache. Any schemas
you selected to be cached in the Cache Schema Properties dialog continue to be cached. To disable caching,
you must remove the schema from the Select Schema list in the Cache Schema Properties dialog.
1. Open the Aster Database Connection Profile wizard or the Aster Database Connection Properties
dialog.
2. Under JDBC Connection Properties, click Delete Cache Files.
3. When you are asked if you want to delete the cache files, click Yes.

Hadoop Connectivity
A Hadoop connection profile defines the information required to connect to an instance of a Hadoop
Database on your system. It contains information such as the database server name, user name, and
password required to establish the connection, port number, Hadoop vendor, and connection properties.
Access to Cloudera or Hortonworks clusters within a Kerberos realm are supported.

Creating a Hadoop Generic System Connection Profile


1. In the Data Source Explorer or Navigator, click to create a new connection.

48 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Hadoop Connectivity
2. Select Hadoop from Connection Profile Types.
3. At Name, type a name to identify the connection profile.
4. [Optional] At Description, type a description of this Connection Profile.
5. Click Next.
6. Select Generic and TDCH as the Connection Service.
7. Specify when to connect:

Option Description
Connect when the wizard completes Connect to the database when you complete the profile.
Connect every time the workbench is Connect to this database each time you launch the
started workbench.
8. Click Next.
9. At WebHDFS Host Name, type the host name or IP address of the system configured to provide
access to the Hadoop system.
10. At WebHDFS Port Number, type the port number to use to communicate with the WebHDFS
service.
11. At System Username, type the user name with permissions to access the WebHDFS host.
12. If the Hadoop cluster has High Availability enabled for the namenode (the cluster has an active and
standby namenode), select HA Enabled Cluster, then type the host name or IP address of the standby
or backup namenode or host in Secondary WebHDFS Host Name.
13. Click Next to view the Summary information.
14. Click Finish to create the connection profile.

Hadoop Cloudera Connection Profiles


When creating Hadoop Cloudera connection profiles, you can select different connection options based on
your current system connection setup and your data transfer needs. You should select Kerberos Security
Authentication if your Hadoop Cloudera system is configured within a Kerberos realm.
Connection Option Description
TDCH Select this option if you plan to use this connection for data transfers
between the Cloudera System and a Teradata Database. Teradata
Connector for Hadoop (TDCH) enables you to move data between
Teradata Databases and Hadoop systems.
Manual metadata update for an Impala instance is required. Please
refer to the REFRESH/INVALIDATE METADATA statements in the
Cloudera Impala documentation.
TDCH is not available for Teradata Studio Express.

Note:
TDCH access is not supported if Kerberos authentication is
selected.

SQL-H Select this option if you plan to use this connection for data transfers
from the Cloudera System to an Aster Database.

Teradata Studio User Guide, Release 16.00 49


Chapter 2: Database Connectivity
Hadoop Connectivity

Connection Option Description


Manual metadata update for an Impala instance is required. Please
refer to the REFRESH/INVALIDATE METADATA statements in the
Cloudera Impala documentation.
SQL-H is not available for Teradata Studio Express.
Smart Loader Select this option if you plan to use this connection to import data
from text delimited files into a Hadoop System.
Impala Select this option if you plan to use this connection to access the
Hadoop Cloudera System using SQL from the SQL Editor. This option
uses the Hive Impala JDBC Driver to access your Hadoop System.
Presto Select this option if you plan to use this connection to access the
Hadoop Cloudera System using SQL from the SQL Editor. This option
uses the Presto JDBC Driver to access your Hadoop System.

Creating Hadoop Cloudera Connection Profiles


You can create a Hadoop Cloudera Connection Profile using the connection options in the New
Connection Profile wizard.
1. In the Data Source Explorer or Navigator, click to create a new connection.
2. Select Hadoop from Connection Profile Types.
3. At Name, type a name to identify the Connection Profile.
4. [Optional] At Description, type a description of the Connection Profile.
5. Click Next.
6. [Optional] If your Hadoop Cloudera system is configured within a Kerberos realm, select Kerberos
under Security Authentication.
7. [Optional] Select TDCH if you plan to use this connection for data transfers between the Hadoop
Cloudera System and a Teradata Database.

Note:
TDCH access is not supported if Kerberos authentication is selected.
8. [Optional] Select SQL-H if you plan to use this connection for data transfers from the Hadoop
Cloudera System to an Aster Database.
9. [Optional] Select Smart Loader if you plan to use this connection to import data from text delimited
files into a Hadoop Cloudera System.
10. [Optional] Select Impala if you plan to use Hive Impala JDBC to create and run SQL.
11. [Optional] Select Presto if you plan to use Presto JDBC to create and run SQL.
If you select this option, you cannot select the Smart Loader option.
12. [Optional] Specify when to connect:

Option Description
Connect when the wizard completes Connect to the database when you complete the profile.
Connect every time the workbench is Connect to this database each time you launch the
started workbench.

50 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Hadoop Connectivity
13. Click Next.
14. If Kerberos authentication is selected you will need to enter the authentication properties.
a) If Smart Load or Impala are selected, enter the name of the Kerberos Realm.
b) If Presto is selected, enter the SSL TrustStore Path and SSL TrustStore Password.
c) Click Next.
15. If you selected a TDCH and/or Smart Load connection, enter the WebHDFS connection credentials:
a) At WebHDFS Host Name, type the host name or IP address of the system configured to provide
access to the Hadoop systems.
b) At WebHDFS Port Number, type the port number to use to communicate with the Hadoop
system.
c) At WebHDFS User Name, type the user name with permissions to access the WebHDFS host.
For systems configured with Kerberos authentication, this should typically be the principal user
name.
d) If the Hadoop cluster has High Availability enabled for the namenode (the cluster has an active and
standby namenode), select HA Enabled Cluster, then type the host name or IP address of the
standby or backup Namenode/WebHDFS host at Secondary WebHDFS Host Name.
e) Click Next.
16. If you selected a SQL-H and/or an Impala or Presto connection, enter the WebHCat connection
credentials:
a) At WebHCat Host Name, type the host name or IP address of the Apache HCatalog system that
manages the metadata services for your Hadoop system.
b) In WebHCat Port Number, type the port number to use to communicate with the WebHCat host.
c) In WebHCat User Name, type the user name with permissions to access the WebHCat host.
For systems configured with Kerberos authentication, this should typically be the principal user
name.
d) Click Next.
17. Select a driver from Select a driver from the drop-down.
The default JDBC driver for the Hadoop provider and connection service is selected. If you want to
create a new driver definition, click .
a) In JDBC Host, type the host name of the Hadoop System to which to connect.
b) In JDBC Port Number, type the port number to use to communicate with the host.
c) In JDBC Database, type the name of the Hadoop database.
d) In JDBC User Name, type the user name to use to connect to the database.
For systems configured with Kerberos authentication, this should typically be the principal user
name.
e) In JDBC Password, type the password required to access the database using Hive JDBC.
f) Select Save Password to save the password.
g) Select HTTP Transport Mode to transfer data using the HTTP secure transfer mode.
h) In HTTP Path type the HTTP server path or accept the default.
i) For connection services other than Presto, select LDAP Security Enabled to enable LDAP
authentication.
j) For a Presto connection, select JDBC Logging to generate JDBC log information.
18. Click Next to view the Summary information.
19. Click Finish to create the connection profile.

Teradata Studio User Guide, Release 16.00 51


Chapter 2: Database Connectivity
Hadoop Connectivity

Hadoop Hortonworks Connection Profiles


When creating Hadoop Hortonworks connection profiles, you can select different connection options based
on your current system connection setup and your data transfer needs. You should select Kerberos Security
Authentication if your Hadoop Hortonworks system is configured within a Kerberos realm.
Connection Option Description
Knox Gateway Select this option if you currently connect to your Hortonworks
Hadoop System through a Knox Gateway. The Apache Knox Gateway
is a REST API gateway for interacting with Hadoop clusters. See
Creating a Hortonworks Self-Signed Certificate for instructions about
retrieving and installing certificate information.
TDCH Select this option if you plan to use this connection for data transfers
between the Hortonworks Hadoop System and a Teradata Database.
Teradata Connector for Hadoop (TDCH) enables you to move data
between Teradata Databases and Hadoop systems.
TDCH is not available for Teradata Studio Express.

Note:
TDCH access is not supported if Kerberos authentication is
selected.

SQL-H Select this option if you plan to use this connection for data transfers
from the Hortonworks Hadoop System to an Aster Database.
SQL-H is not available for Teradata Studio Express.
Smart Loader Select this option if you plan to use this connection to import data
from text delimited files into a Hadoop System.
Hive Select this option if you plan to use this connection to access the
Hortonworks Hadoop System using SQL from the SQL Editor. This
option uses the Hortonworks Hive JDBC Driver to access your
Hadoop System.
Presto Select this option if you plan to use this connection to access the
Hortonworks Hadoop System using SQL from the SQL Editor. This
option uses the Presto JDBC Driver to access your Hadoop System.

Creating a Hortonworks Self-Signed Certificate


If you are using a Knox Gateway for connection to a Hortonworks Hadoop system and the Knox Gateway
uses a certificate that is not issued by a trusted certificate authority (for example, it uses a self-signed
certificate), you must retrieve the certificate used by the Knox server and install it in your Java Runtime
certificate store.
1. Retrieve the Knox certificate by doing one of the following:

52 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Hadoop Connectivity
Option Description

From the Run the command: keytool -export -alias gateway-identity -rfc -
Knox server file knox.crt -keystore <path to gateway.jks keystore. For
example: /usr/lib/knox/data/security/keystore/gateway.jks

From a web Follow your browser's instructions for exporting a certificate. For example, if you use
browser Chrome:
a. Enter the Knox server:port in the address bar. You will see a message that the
connection is not private.
b. Click Advanced, and then click the Proceed to site link.
c. Click on the lock in the address bar and select Details.
d. Click View certificate.
e. Select the Details tab in the resulting dialog and click the Copy to file... button.
f. In the resulting Certificate Export Wizard, save the certificate as Base-64 encoded.

2. Install the certificate into your Java Runtime certificate store by running the command: %JDK_HOME%
\bin\keytool.exe -importcert -alias "TDH240 Knox self-signed certificate" -
file cert_location/<filename>.txt -keystore %JRE_HOME%\lib\security\cacerts
where %JDK_HOME% is an environment variable with the location of a JDK and %JRE_HOME% is the
location of the JRE used to run Studio.
The keytool.exe will ask for the password to the certificate store. The password is changeit unless you
have already changed it.

Creating Hadoop Hortonworks Connection Profiles


You can create a Hadoop Hortonworks Connection Profile using the connection options in the New
Connection Profile wizard.
1. In the Data Source Explorer or Navigator, click to create a new connection.
2. Select Hadoop from Connection Profile Types.
3. At Name, type a name to identify the Connection Profile.
4. [Optional] At Description, type a description of the Connection Profile.
5. Click Next.
6. [Optional] Select Knox Gateway if you currently connect to your Hortonworks Hadoop System
through a Knox Gateway.
If you select this option, the Smart Load and Hive JDBC options are selected and disabled as no
additional information is required for those options when Knox is selected. Kerberos is unselected and
disabled since only Knox credentials are used to establish a connection, even on a Kerberized cluster.
Presto is also unselected and disabled as it is not supported with Knox.
7. [Optional] Select TDCH if you plan to use this connection for data transfers between the Hortonworks
Hadoop System and a Teradata Database.

Note:
TDCH access is not supported if Kerberos authentication is selected.
8. [Optional] Select SQL-H if you plan to use this connection for data transfers from the Hortonworks
Hadoop System to an Aster Database.

Teradata Studio User Guide, Release 16.00 53


Chapter 2: Database Connectivity
Hadoop Connectivity
9. [Optional] Select Smart Loader if you plan to use this connection to import data from text delimited
files into a Hortonworks Hadoop System.
If you select this option, Hive is automatically selected as the Hortonworks Hive JDBC Driver will be
used to access the Hortonworks Hadoop System.
10. [Optional] Select Hive if you plan to use Hive JDBC to create and run SQL.
11. [Optional] Select Presto if you plan to use Presto JDBC to create and run SQL.
If you select this option, you cannot select the Smart Loader option.
12. [Optional] Specify when to connect:

Option Description
Connect when the wizard completes Connect to the database when you complete the profile.
Connect every time the workbench is Connect to this database each time you launch the
started workbench.
13. Click Next.
14. If you selected the Knox Gateway option, specify the properties for the Knox gateway connection:
a) At Gateway Host, type the host name.
b) At Gateway Port Number, type the port number for the host.
c) At Cluster Name, type the cluster name.
d) At Gateway User Name, type the user name for the Knox Gateway.
e) [Optional] In Gateway Password, type the password for the Knox Gateway.
f) Select Save Password to save the password.
g) Select SSL Enabled to enable Secure Sockets Layer encryption.
h) Select a driver from Select a driver from the drop-down.
The default JDBC driver for the Hadoop provider and connection service is selected. If you want to
create a new driver definition, click .
i) Click Next.
15. If Kerberos authentication is selected you will need to enter authentication properties.
a) If Smart Load or Hive are selected, enter the name of the Kerberos Realm.
b) If Presto is selected, enter the SSL TrustStore Path and SSL TrustStore Password.
c) Click Next.
16. If you selected a TDCH and/or Smart Load connection, enter the WebHDFS connection credentials:
a) At WebHDFS Host Name, type the host name or IP address of the system configured to provide
access to the Hadoop systems.
b) At WebHDFS Port Number, type the port number to use to communicate with the Hadoop
system.
c) At WebHDFS User Name, type the user name with permissions to access the WebHDFS host.
For systems configured with Kerberos authentication, this should typically be the principal user
name.
d) If the Hadoop cluster has High Availability enabled for the namenode (the cluster has an active and
standby namenode), select HA Enabled Cluster, then type the host name or IP address of the
standby or backup Namenode/WebHDFS host at Secondary WebHDFS Host Name.
e) Click Next.
17. If you selected a SQL-H and/or Hive or Presto connection, enter the WebHCat connection credentials:

54 Teradata Studio User Guide, Release 16.00


Chapter 2: Database Connectivity
Oracle, DB2, and SQL Server Connections
a) At WebHCat Host Name, type the host name or IP address of the Apache HCatalog system that
manages the metadata services for your Hadoop system.
b) In WebHCat Port Number, type the port number to use to communicate with the WebHCat host.
c) In WebHCat User Name, type the user name with permissions to access the WebHCat host.
For systems configured with Kerberos authentication, this should typically be the principal user
name.
d) Click Next.
18. If you specified a Smart Loader, Hive, or Presto connection, select a driver from Select a driver from
the drop-down.
The default JDBC driver for the Hadoop provider and connection service is selected. If you want to
create a new driver definition, click .
a) In JDBC Host, type the host name of the Hadoop System to which to connect.
b) In JDBC Port Number, type the port number to use to communicate with the host.
c) In JDBC Database, type the name of the Hadoop database.
d) In JDBC User Name, type the user name to use to connect to the database.
For systems configured with Kerberos authentication, this should typically be the principal user
name.
e) In JDBC Password, type the password required to access the database using Hive JDBC.
f) Select Save Password to save the password.
g) Select HTTP Transport Mode to transfer data using the HTTP secure transfer mode.
h) In HTTP Path type the HTTP server path or accept the default.
i) For connection services other than Presto, select LDAP Security Enabled to enable LDAP
authentication.
j) Select JDBC Logging to generate JDBC log information.
19. Click Next to view the Summary information.
20. Click Finish to create the connection profile.

Oracle, DB2, and SQL Server Connections


The system also supports connections to Oracle, DB2, and SQL Server Connections. These connections are
contributed by the vendors to Eclipse. To use these connections, contact the vendor for the JDBC driver and
instructions.

Teradata Studio User Guide, Release 16.00 55


Chapter 2: Database Connectivity
Oracle, DB2, and SQL Server Connections

56 Teradata Studio User Guide, Release 16.00


CHAPTER 3
Database Administration

Teradata Database

Database Object Management

Viewing Database Objects


1. In the Administration perspective, right-click a database or user in the Navigator tree and select the
applicable Show action for the item you want to view.
You can select Show All Objects to display a comprehensive list.
A list of those types of objects contained in the selected database or user appears in the Object List
Viewer.
2. In the Object List Viewer, right-click and select the applicable Open action for the item you want to
view.
A property form for the selected object opens in the Details view.

Creating Database Objects


1. In the Administration perspective, right-click a database or user in the Navigator tree and select the
applicable Show action for the item you want to create.
A list of those types of objects contained in the selected database or user appears in the Object List
Viewer.
2. In the Object List Viewer toolbar, click the applicable Create action for the object you want to create.
An object type-specific property form opens in the Details view.
3. In the property form for the new object, enter a name for the object.
4. Enter the properties that define your new object in the appropriate fields.
5. [Optional] Click the SQL tab to see the SQL DDL that will be sent to the connected database to create
your new object.
6. Click Commit to create your new object.

Modifying Database Objects


Many object types, including Profiles, Roles, Foreign Servers, and Secure Zones, can be modified using the
following process:
1. In the Administration perspective, right-click a database or user in the Navigator tree and select the
applicable Show action for the object you want to modify.
A list of those types of objects contained in the selected database or user appears in the Object List
Viewer.

Teradata Studio User Guide, Release 16.00 57


Chapter 3: Database Administration
Teradata Database
2. In the Object List Viewer toolbar, right-click the object you want to modify and select the applicable
Modify action for the object you want to modify.
A property form for the selected object opens in the Details view.
3. In the property form for the new object, modify the properties you want to change.
4. [Optional] Click the SQL category to view the SQL DDL.
5. Click Commit to modify the object according to the settings you changed.

Dropping Database Objects


Dropping a database object removes the specified object from the database.
1. In the Administration perspective, right-click a database or user in the Navigator tree and select the
applicable Show action for the kind of object you want to drop.
A list of those types of objects in the selected database or user appears in the Object List Viewer.
2. In the Object List Viewer, right-click one or more objects that you want to drop and select Drop.
3. [Cloudera Only] In the Drop Confirmation message for Cloudera Hadoop connections using the
Impala JDBC driver, select Refresh Impala Metadata to refresh the metadata after the drop.
4. In the Drop Confirmation message, click Yes to confirm the drop operation.
The selected object or group of objects are dropped from the connected database.

Foreign Server Administration


A foreign server object contains connection details to a remote database system. It also defines associations
with table operators that provide the ability to import and export data.

Note:
Foreign server administration is only available for 15.00.02.04+ systems.

Creating a Foreign Server


To define a foreign server, you must have the CREATE SERVER privilege on the database that stores the
server objects. To associate a server with table operators, you must also have EXECUTE FUNCTION and
SELECT privileges on the specified table operators.
1. In the Navigator pane of the Administration perspective, right-click on Foreign Servers and select
Show Foreign Servers from the pop-up menu.
A list of foreign servers displays in the Object List Viewer.
2. In the Object List Viewer toolbar, click (Create Foreign Server).
The Foreign Server property form appears in the Details view.
3. Click General.
a) In Name, type the name of the foreign server object; for example, hcatalog_server.
b) In Host Type, specify the type of the host; for example, hadoop.
c) [Optional] In Comment, type the comments for the foreign server.
4. [Optional] Click Security to specify the name and security type for the authorization that stores the
credentials for the foreign server.
a) [Optional] In Trusted Credential, select a security type from the list.

58 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
• Definer — Indicates the authorization that describes the trusted remote user credentials is present
in the database that contains the foreign server. You can specify either a Definer or an Invoker, but
not both.
• Invoker — Indicates the authorization that describes the trusted remote user credentials is present
in the user database at the time the foreign server is accessed. You can assign only one INVOKER
authorization name per database.
b) In Authorization, type the name for the authorization.
5. Click Name Value Pairs and identify the name value pairs that the table operators can use to connect to
this foreign server.
Name value pairs for host type are automatically generated as available using pairs. The pairs are global
attributes of the server object. The host type name value pair is always displayed as the first in the name
value pairs table; other pairs cannot be moved above it.

Note:
Name value pairs for host type must be edited in the General tab.

Button Description
Add a. Click Add.
b. Click in the Value Type column and select the type.
c. If you selected Simple Value or Scalar SubQuery Value, enter the name in the Name
column and the value or subquery in the Value column. If you selected System Variable
Value, enter the Name, click in the Value column, and select a system variable.

Remove Click Remove to remove the selected name value pair.


Up Click Up to move the selected name value pair up in the list order
Down Click Down to move the selected name value pair down in the list order
6. [Optional] Click Import to associate an IMPORT table operator with this foreign server for importing
data into Teradata Database.
The name value pairs that you create for importing data are local attributes of the IMPORT table
operator.
a) In Database, select the name of the database that contains the import table operator.
b) In Table Operator, select the name of the table operator to use.
c) In Name Value Pairs, use the Add, Remove, Up, and Down buttons to create a list of name value
pairs that this table operator uses to import data.
7. [Optional] Click Export to associate an EXPORT table operator with this foreign server for exporting
data out of Teradata Database.
The name value pairs that you create for exporting data are local attributes of the EXPORT table
operator.
a) In Database, select the name of the database that contains the export table operator.
b) In Table Operator, select the name of the table operator to use.
c) In Name Value Pairs, use the Add, Remove, Up, and Down buttons to create a list of name value
pairs that this table operator uses to export data.
8. Click SQL to view the generated DDL that creates the foreign server.
9. Click Commit to execute this statement.

Teradata Studio User Guide, Release 16.00 59


Chapter 3: Database Administration
Teradata Database
Altering Foreign Server Properties
You can modify certain attributes of an existing foreign server object, such as the name value pairs
associated with the server.
1. In the Navigator pane of the Administration perspective, right-click on Foreign Servers and select
Show Foreign Servers from the pop-up menu.
A list of foreign servers displays in the Object List Viewer.
2. In the Object Viewer, right-click on the desired foreign server and select Modify Foreign Server from
the pop-up menu.
The Foreign Server property form displays in the Details view.
3. [Optional] Click General to edit foreign server information:
You cannot edit the name of the foreign server.

Option Description
Host Type Change the type of the host.
Comment Change the comments for the foreign server.
4. [Optional] Click Security to specify the name and security type for the authorization that stores the
credentials for the foreign server.
a) In Trusted Credential, select a security type from the list.
• Definer — Indicates the authorization that describes the trusted remote user credentials is present
in the database that contains the foreign server. You can specify either a Definer or an Invoker, but
not both.
• Invoker — Indicates the authorization that describes the trusted remote user credentials is present
in the user database at the time the foreign server is accessed. You can assign only one INVOKER
authorization name per database.
• None — Indicates that this foreign server does not support associated credentials.
b) In Authorization, change the name for the authorization.
5. [Optional] Click Name Value Pairs and identify the name value pairs that the table operators can use to
connect to this foreign server.
Name value pairs for host type, remote server, and port are automatically generated as available using
pairs. Changing the server information in General, changes the name value pairs. The pairs are global
attributes of the server object.
• To add a name value pair, click the Add button and type a name in the Name column and the value
in the Value column.
• To edit a name value pair, change the name in the Name column or the value in the Value column,
and click Add.
• To remove a pair, select the name value pair and click Remove. You cannot remove the host type,
remote server, or port using pairs.
• To move a pair up in the list order, select the name value pair and click Up.
• To move a pair down in the list order, select the name value pair and click Down.
6. [Optional] Click Import to associate an IMPORT table operator with this foreign server for importing
data into Teradata Database.
These name value pairs are local attributes of the IMPORT table operator.
a) In Database, type the name of the database that contains the import table operator.
b) In Table Operator, type the name of the table operator to use.

60 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
c) In Name Value Pairs, use the Add, Remove, Up, and Down buttons to create a list of name value
pairs that this table operator uses to import data.
7. [Optional] Click Export to associate an EXPORT table operator with this foreign server for exporting
data out of Teradata Database.
These name value pairs are local attributes of the EXPORT table operator.
a) In Database, type the name of the database that contains the export table operator.
b) In Table Operator, type the name of the table operator to use.
c) In Using Pairs, use the Add, Remove, Up, and Down buttons to create a list of name value pairs that
this table operator uses to export data.
8. Click SQL to view the generated DDL that changes the foreign server definition.
9. Click Commit to execute this statement.

Dropping a Foreign Server

1. In the Navigator pane of the Administration perspective, right-click on Foreign Servers and select
Show Foreign Servers from the pop-up menu.
A list of foreign servers displays in the Object List Viewer.
2. In the Object List Viewer, select the foreign server you want to delete.
You can select multiple foreign servers to drop at the same time.
3. In the Object Viewer toolbar, click (Drop Foreign Server).
4. Click Yes when prompted to confirm the DROP action.
The foreign server is dropped from the connected database and disappears from the Object List Viewer
list.

Secure Zones Administration


Secure zones allow you to create one or more exclusive database hierarchies, called zones, within a single
Teradata Database system. Access to the data in each zone and the database administration is handled
separately from the Teradata Database system and from other zones. Secure zones are useful in situations
where the access to data must be tightly controlled and restricted. You can also use secure zones to support
some regulatory compliance requirements for the separation of data access from database administration
duties.
For more information, see Security Administration.
You can use Teradata Studio to administer secure zones, including creating and dropping zones, and
managing zone and guest users.
Secure zones are supported on Teradata Database 15.10 or later.

Listing Secure Zones


You can view a list of secure zones that are set up on a Teradata Database system in the Object List Viewer.
From this view, you can administer the secure zones and zone users. The list varies depending on your
permissions.
1. In the Navigator pane, expand the desired Teradata Database system name.
2. Right-click Secure Zones and select Show Secure Zones.

Teradata Studio User Guide, Release 16.00 61


Chapter 3: Database Administration
Teradata Database
Existing secure zones that you have permissions to view are listed in the Object List Viewer.
3. [Optional] Filter the results using the Filters view.

Creating a Secure Zone


You can create secure zones on Teradata Database 15.10 or later.
1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. In the upper right corner of the Object List Viewer, click .
The Create Secure Zone pane appears.
3. Fill out the desired information in the tabs.
4. [Optional] Click SQL to review the generated SQL statements.
5. Click Commit.
A new secure zone is created.

Dropping a Secure Zone


If you no longer need a secure zone, you can drop, or delete, it. Before you drop it, remove any users from
the zone.
1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. Remove all users from the secure zone you want to drop.
3. In the Object List Viewer, select the row listing for the secure zone you want to drop.
4. Right-click and select Drop Secure Zone, and click OK to confirm.
The secure zone is deleted from the Teradata Database.

Modifying a Secure Zone


You can modify the root of an existing secure zone. Note that changing the zone root changes the entire
dynamic of the secure zone.
1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. On the desired row, right-click and select Modify Secure Zone.
The Modify Zone pane appears.
3. Edit the settings.

Option Description
Name Name of the secure zone.
Zone DBA Name of the primary zone DBA. You cannot edit this field.
Root Name The zone root associated with this secure zone. To change the zone root, it must not have
any objects, descendants, roles, or profiles assigned to it.
4. [Optional] Click SQL to review the generated SQL statements.
5. Click Commit.
The secure zone settings are updated.

62 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
Adding Users to a Secure Zone
A zone user is a permanent database user with privileges in a zone. The first user added to a secure zone
automatically becomes the primary zone DBA. Only the primary zone DBA can create further users.
1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. On the desired row, right-click and select Add/Drop Secure Zone Users.
The Add/Drop Users tab appears.
3. Click Users in Zone.
4. Expand the Users tree and right-click the name of the database or user, select Create Zone User and
click OK to open the Create User Form.
5. Fill out the desired information in the tabs.
6. [Optional] Click SQL to review the generated SQL statements.
7. Click Commit.
A new zone user is created and added to the secure zone, and the user information appears.
8. [Optional] To refresh the Users tree with the newly added zone user, do the following:
a) In the Add/Drop Users tab, under Users in Zone, right-click Users in the tree.
b) Click Refresh.
The Users tree includes the user you added.

Removing Users from a Secure Zone


1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. On the desired row, right-click and select Add/Drop Secure Zone Users.
3. Click Users in Zone.
The user tree appears.
4. Right-click the name of the database or user, select Drop Zone User and click OK.
5. Click Commit.
The zone user is removed from the secure zone.

Adding Zone Guests to a Secure Zone


Zone guests are roles or users that are located outside of the zone, but are granted privileges to create and
access objects in the zone where they are guests.
1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. On the desired row, right-click and select Add/Drop Secure Zone Users.
3. Click Users in Zone.
The user tree appears.
4. Right-click Users and select Add/Remove Zone Guests.
The Choose Zone Guests dialog appears, listing all database users.
5. Select guests by users or roles, and use the arrow buttons to add them to the Zone Guests list.
6. Click OK.
7. [Optional] Click SQL to review the generated SQL statements.
8. Click Commit.
New zone guest users are granted privileges, and a list of current users appears.

Teradata Studio User Guide, Release 16.00 63


Chapter 3: Database Administration
Teradata Database
Removing Zone Guests From a Secure Zone
1. List existing secure zones for the desired Teradata Database in the Object List Viewer.
2. On the desired row, right-click and select Add/Drop Secure Zone Users.
3. Click Users in Zone.
The user tree appears.
4. Right-click Users and select Add/Remove Zone Guests.
The Choose Zone Guests dialog appears.
5. Select guests in the Zone Guests list and use the arrow buttons to remove them from the list.
6. Click OK.
7. Click Commit.

Database and User Management

Creating a Teradata Database or User


1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. In the Object List Viewer toolbar, click (database) or (user).
A Create Database or Create User property form opens in the Details view.
3. In the property form, enter property values for the new database or user.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new database or user.
5. Click Commit.
The database or user is created in the connected database, and a dialog opens to confirm the operation.
6. Click OK.
A property form shows the properties of the new database or user.

Viewing Teradata Database or User Properties


1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. Right-click the database or user for which you want to see properties, and click Open Database/User.

Modifying Teradata Database or User Properties


1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. Right-click the database or user for which you want to modify, and click Modify Database/User.
3. Modify properties by entering new information into the property fields.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
modify the database or user.

64 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
5. Click Commit.
The database or user is modified in the connected database, and a dialog opens to confirm the operation.
6. Click OK.
A property form showing the new properties of the database or user.

Cloning a Teradata Database or User


Cloning a database or user creates a new database or user that starts with the same properties as the original
database. You can change any of those properties before you create the new database or user.
1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. Right-click the database or user you want to clone, and click Open Database/User.
3. Enter a unique name for the new database or user, and modify any properties you want to change by
entering new information into the property fields.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
modify the database or user.
5. Click Commit.
The new database or user is created in the connected database.
6. Click OK.
The clone property form is replaced by a property form for the new database or user.

Table Management

Adding a Teradata Table


At minimum, a Teradata table must have a table name, table type, and one column defined. If you need to
undo a table definition at any time, click Reset to delete your entries and begin again.
1. In the Administration perspective, click a Teradata connection.
2. In the Navigator, double-click on the Databases category.
The database list opens in the Object List Viewer.
3. Locate the database and schema where you want to create a table.
4. In the Object List Viewer, click to show tables, then click it again to add a table.
The Create Table form displays.
5. In the General tab, type a Name for the new table.
6. Complete the other optional fields on the General tab.
7. Click Columns and for each column you add to the table, complete the following information:
a) Type the name of the new column in Name.
b) Select the Data Type.
c) In Length, type the maximum data length allowed for column data if appropriate for the selected
type.
d) Type the maximum Precision allowed for numeric column data.

Teradata Studio User Guide, Release 16.00 65


Chapter 3: Database Administration
Teradata Database
The precision of a numeric is the total count of digits in the whole number (both sides of a
decimal). For example, the number 3068.443 has a precision of 7. The precision must be a positive
number.
e) Type the maximum Scale allowed for numeric column data.
The scale of a numeric is the count of decimal digits in the fractional part of the number to the right
of the decimal point. For example, the number 3068.443 has a scale of 3. The scale of an integer is
considered zero, therefore, scale can be zero or a positive number.
f) Select Null if data values in this column can be null.
g) Select Unique if data values in this column must be unique.
h) [Optional] Add a Comment if appropriate.
8. [Optional] Click Column Grouping and add any grouping information.
9. [Optional] Click Indexes and add indexes for this table.
10. [Optional] Click Constraints and add constraint information.
11. [Optional] Click Miscellaneous and complete any information.
12. Click SQL and review the generated statement.
To modify the CREATE TABLE statement, return to previous steps to change your selections. You can
also copy and paste the text into an SQL Editor to make edits.
13. Click Commit to execute the statement and update the table definition on the Database server.

Profile Management
About User Profiles
You can group sets of configuration settings that are commonly used and assigned to users in profiles. Any
user created as a member of the profile automatically inherits the profile settings. If no settings are specified
for the profile, the default system-level settings are used. Settings in the user profile override the settings for
the user in a CREATE USER or MODIFY USER statement. Password attribute settings in a user profile
override the corresponding system-level password settings.

Note:
Changes to password attribute settings in a profile do not require a system restart to take effect. The new
settings take effect the next time the users assigned to the profile log on.

Required Privileges

To You must have


Create a profile CREATE PROFILE
Add users to a profile DROP PROFILE
Drop a profile DROP PROFILE

About Dropping User Profiles


When you drop a user profile, the users who have the profile assigned to them continue to have that profile
assigned to them. The system does not reset the profile for these users to NULL, and the system does not
send warnings or errors the next time they log on.
When users log on after a profile drop, the system uses the password attribute setting defined for the system.
Spool and temporary space settings immediately change to the settings originally defined for the affected

66 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
users. Account and database settings change to the setting defined for the affected users the next time the
users log on or explicitly change the settings.
The effects of re-creating a profile with the same name as the dropped profile are not immediate. The
parameter settings in the re-created profile take effect the next time the users who are assigned the profile log
on.

Note:
Profile Query Band Administration and Profile Row Level Security Constraint Administration are
enabled for the Admin Profile form.

For More Information


For more information on profiles, see SQL Data Definition Language - Syntax and Examples and Database
Administration.

Creating a Profile
A profile defines a set of user resource parameters, such as spool space allocations, password control
parameters, and query bands. When a new user is created, they can be assigned a profile to automatically
confer on them the resources defined for the profile.
1. In the Navigator, right-click Profiles, and click Show Profiles.
A list of profiles defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer, click .


A Create Profiles property form opens in the Details view.
3. Enter the properties that define your new profile.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new profile.
5. Click Commit.
The profile is created in the connected database.
6. Click OK.
A property form shows the new profile properties.

Viewing Profile Properties


A profile defines a set of user resource parameters, such as spool space allocations, password control
parameters, and query bands. When a new user is created, they can be assigned a profile to automatically
confer on them the resources defined for the profile.
1. In the Navigator, right-click Profiles, and click Show Profiles.
A list of profiles defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer, right-click the profile you want to view, and click Open Profile.
A property form shows the profile properties.

Teradata Studio User Guide, Release 16.00 67


Chapter 3: Database Administration
Teradata Database
Modifying Profile Properties
A profile defines a set of user resource parameters, such as spool space allocations, password control
parameters, and query bands. When a new user is created, they can be assigned a profile to automatically
confer on them the resources defined for the profile.
1. In the Navigator, right-click Profiles, and click Show Profiles.
A list of profiles defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer, right-click the profile you want to modify, and click Modify Profile.
A Modify Profile property form opens in the Details view.
3. Modify properties by entering new information into the property fields.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
modify the profile.
5. Click Commit.
The profile is modified in the connected database.
6. Click OK.
A property form shows the modified profile properties.

Privileges Modifications
Privileges can be granted and modified at the system or object level. For more information about which
privileges are associated with the Public Role, and User grantee type, see SQL Data Control Language.

Granting and Modifying Object-Level Privileges


You can grant or modify object-level privileges (database, table, view, or macro-level) to users or roles and
column rights to users or roles.
1. From the Administration perspective, select an object in the Navigator.
A list of available objects display in the Object List Viewer.
2. Click to highlight the object in the Object List Viewer and do one of the following:

• From the toolbar, click .


• Right-click an object and select Modify Privileges.
The Modify Privileges form will display. Depending on the type of object selected, this form will have
different tabs (listed below, with applicable object types and description). The functionality of these tabs
are similar.
Tab Applicable Objects Description
Privileges Granted Database, User Grant privileges on a user or database to the
selected grantee.
Privileges Held Database, User, Role Select objects to grant or revoke privileges from.
Object Level Privileges All Object Types Grant privileges to selected grantees.
Column Rights Table, View Grant or modify column rights.

68 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
3. Select either the Privileges Granted, Privileges Held, or Object Level Privileges tabs to grant or modify
privileges (the functionality is similar for each of these forms). Repeat as necessary for each available
form:
a) Select a grantee type from the menu.
For more information about which privileges are associated with the Public Role, and User grantee
type, see SQL Data Control Language.
A list of grantees displays under Grantees.
b) If User is selected, select the user's root database.
The Grantees box refreshes and displays a list of grantees associated with the selected root database.
c) In the Grantees box, select one or more grantees to modify.
d) Under Display Privileges, select one or more privilege types you would like to grant, and click
Display Selected.
The states of the privileges in the table are indicated by the Legend. If the privilege in the table is
shown in a square box, it indicates that the privilege is set for the grantee (meaning that the user has
not changed the state of the privilege). If the privilege in the table is shown in a circle, it indicates that
the user has made a change from the original setting to the indicated state.
The available privileges display in a table under the Legend. Grantees are listed in the Name column
and the remaining columns display the privileges that you can grant.
e) The Legend shows the different states of a privilege (not all of these states applicable every privilege).
Privilege State Description
Not granted Privilege is not granted to the grantee.
Granted Privilege is granted to the grantee.
Granted with grant Privilege is granted to the grantee, along with the ability to grant this privilege
to others.
Revokes Privilege is revoked from the grantee.
Grants Privilege is granted by the grantee.
Grants with grant Privilege is granted by the grantee, along with the ability to grant this privilege
to others.
f) Under Grant Options, select one or both of the following options:
Option Description
All Children Select to extend general access privileges to all the children of the selected user.
Only available for the User grantee type.
With Grant Select to give Public or User the ability to grant privileges to other users. Only
available for the Public and User grantee type.
4. If the selected object type is table or view, then select Column Rights in the left pane to grant or modify
column rights (this is not available for other object types).
a) Select a grantee type from the menu.
For more information about which privileges are associated with the Public Role, and User grantee
type, see SQL Data Control Language.
A list of grantees displays under Grantees.
b) If User is selected, select the user's root database.
The Grantees box refreshes and displays a list of grantees associated with the selected root database.

Teradata Studio User Guide, Release 16.00 69


Chapter 3: Database Administration
Teradata Database
c) In the Grantees box, select one or more grantees to modify.
For each selected grantee, the names of the table or view columns are listed in the Name column,
followed by the Grantees' names if more than one Grantee was selected.
d) Under Grant Options, select one or both of the following options:
Option Description
All Children Select to extend general access privileges to all the children of the selected user.
Only available for the User grantee type.
With Grant Select to give Public or User the ability to grant privileges to other users. Only
available for the Public and User grantee type.
5. Click Commit to execute the DDL that will apply the changes to all modified privileges.
6. [Optional] Verify the privileges by double-clicking the object in the Object List Viewer to open a tab in
the Project Explorer, and click Privileges in the left pane.

Granting and Modifying System Privileges


You can grant or modify system privileges for users and roles only.
1. From the Navigator in the Administration perspective, do one of the following:
• To modify system privileges for a user, right-click the Databases node and click Show Databases.
• To modify system privileges for a role, right-click the Roles node and click Show Roles
A list of either users or roles (depending on your selection) appears in the Object List Viewer.
2. Click to highlight one or more users or roles in the Object List Viewer and do one of the following:
• Click to select one or more users or roles, then click (modify system privileges).
• Right-click a user or role and click -Modify System Privileges.
The Modify System Rights property form appears in the Details view, with the selected users or roles in
the Grantees list.
3. Select the Privileges category in the left pane to grant or modify system privileges on the selected object.
a) Under Display Privileges, select one or more privilege types to grant to the selected grantees, and
click Display Selected.
The available privileges display in a table under the Legend. Grantees are listed in the Name column
and the remaining columns display the privileges that you can grant.
b) Under Grant Options, select one or both of the following options:
Option Description
All Children Select to extend general access privileges to all the children of the selected user.
Only available for the User grantee type.
With Grant Select to give Public or the selected user grantees the ability to grant privileges
to other users. Only available for the Public and User grantee type.
4. Once the privileges are changed, click Commit.
5. [Optional] Verify the privileges by double-clicking the object in the Object List Viewer to open a tab in
the Project Explorer, and click Privileges in the left pane.

70 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Trigger Management

Displaying Triggers in a Database


You can display all of the triggers in a database in the Object List Viewer, and open, modify, disable, or drop
a trigger from that view. If you want to create a new trigger, you must first show the table on which you want
to define the trigger.

1. In the Navigator, double-click the Databases category.


A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. Right-click a database or user, and click Show Triggers.
The triggers in the database are displayed. The display includes a Table Database column indicating the
database containing the table on which the trigger is defined.

Creating a Trigger
Triggers automatically perform SQL operations in response to INSERT, UPDATE, DELETE, or MERGE
modifications of the tables on which they are defined.
1. In the Navigator, right-click the database or user that contains the table for which you want to define a
trigger, and click Show Tables.
A list of the tables the database or user contains appears in the Object List Viewer.
2. In the Object List Viewer, right-click the table for which you want to define a trigger, and click Show
Triggers.
Any triggers that have been defined for the table are listed in the Object List Viewer.
3. In the Object List Viewer, click .
A Create Trigger property form opens in the Details view.
4. Enter the properties that define your new trigger.
For more information on creating triggers, see SQL Data Definition Language and SQL Fundamentals.
5. [Optional] Click the SQL tab to see the SQL code that will be executed on the connected system to create
the new trigger.
6. Click Commit.
If an error is returned, modify your trigger properties to address the error.
The trigger is created in the connected database.
7. Click OK.
A property form shows the new trigger properties.

Enabling or Disabling a Trigger


Triggers automatically perform SQL operations in response to INSERT, UPDATE, DELETE, or MERGE
modifications of the tables on which they are defined.
1. In the Navigator, right-click the database or user that contains the table for which you want to enable or
disable a trigger, and click Show Tables.
A list of the tables the database or user contains appears in the Object List Viewer.
2. In the Object List Viewer, right-click the table for which you want to enable or disable a trigger, and
click Show Triggers.

Teradata Studio User Guide, Release 16.00 71


Chapter 3: Database Administration
Teradata Database
Any triggers that have been defined for the table are listed in the Object List Viewer.
3. In the Object List Viewer, right-click the trigger you want to enable or disable, and click Enable Trigger
or Disable Trigger.
The value in the Enabled column of the Object List Viewer changes to reflect the new state of the
trigger.

Viewing Trigger Properties


Triggers automatically perform SQL operations in response to INSERT, UPDATE, DELETE, or MERGE
modifications of the tables on which they are defined.
1. In the Navigator, right-click the database or user that contains the table for which you want to view
trigger properties, and click Show Tables.
A list of the tables the database or user contains appears in the Object List Viewer.
2. In the Object List Viewer, right-click the table for which you want to view trigger properties, and click
Show Triggers.
Any triggers that have been defined for the table are listed in the Object List Viewer.
3. In the Object List Viewer, right-click the trigger you want to view, and click Open Trigger.

Modifying Trigger Properties


Triggers automatically perform SQL operations in response to INSERT, UPDATE, DELETE, or MERGE
modifications of the tables on which they are defined.
1. In the Navigator, right-click the database or user that contains the table for which you want to modify a
trigger, and click Show Tables.
A list of the tables the database or user contains appears in the Object List Viewer.
2. In the Object List Viewer, right-click the table for which you want to modify a trigger, and click Show
Triggers.
Any triggers that have been defined for the table are listed in the Object List Viewer.
3. In the Object List Viewer, right-click the trigger you want to modify, and click Modify Trigger.
A Modify Trigger property form opens in the Details view.
4. Modify properties by entering new information into the property fields.
5. [Optional] Click the SQL tab to see the SQL code that will be executed on the connected system to
modify the trigger.
6. Click Commit.
If an error is returned, modify your trigger properties to address the error.
The trigger is modified in the connected database.
7. Click OK.
A property form shows the modified trigger properties.

Roles Management
About Roles
A role defines a set of privileges on database objects. Database administrators (DBAs) can define different
roles for different job functions and responsibilities, then assign those roles to different users. Typically,
users are members of more than one role. Roles can also be assigned to other roles.

72 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
Assigning a default role to a user gives that user access to all the objects for which the role has access
privileges. A default role that has been granted other roles provides a user to which it is assigned additional
access to all the objects on which the nested roles have privileges. The privileges of a role granted to another
role are inherited by every user member of the grantee role.
Right-click a role in the Object List Viewer and click Modify Privileges to grant or revoke role privileges
for that role on database objects selected in the form.
Right-click one or more roles in the Object List Viewer and click Modify System Privileges to grant or
revoke system-level privileges for these Roles.

About Role Types


There are two basic types of roles.
Role Type Description
Internal Database-managed roles; useful as roles that only apply to a single database
platform.
External Directory-managed; provide capability to centralize the management of
enterprise-wide roles in a directory.

Required Privileges
You must have the CREATE ROLE privilege to create a role. This applies to both standard database roles
and external roles. When you create a role, you automatically receive the creator privileges. This gives you
the DROP ROLE privilege and the WITH ADMIN OPTION privilege, but does not give you the privilege to
assign a default role to a user. A newly created role has no associated privileges until the privileges are
granted.

Task Required Privilege


To modify a user's default CREATE USER or DROP USER
role
To grant a role to a user or WITH ADMIN OPTION privilege on the role
other role

About Dropping a Default Role


Dropping a role removes all members from the role. If you drop a default role, the system no longer uses the
role by default to check privileges when the user logs on, and does not return an error or warning. The result
of dropping a role does not cascade to users logged on to the database.

For More Information


For more information on roles, see SQL Data Definition Language - Syntax and Examples and Database
Administration.

Creating a Role
A role defines a set of database privileges on database objects. A user who is assigned a role automatically
gains all the privileges of that role. For more information on roles and privileges, see SQL Fundamentals,
SQL Data Control Language, and SQL Data Definition Language - Syntax and Examples.
1. In the Navigator, right-click Roles, and click Show Roles.

Teradata Studio User Guide, Release 16.00 73


Chapter 3: Database Administration
Teradata Database
A list of the roles defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer toolbar, click .
A Create Role property form opens in the Details view.
3. In the property form, enter property values for the new role.
4. [Optional] Click the SQL tab to see the SQL code that will be executed on the connected system to create
the new role.
5. Click Commit.
6. Click OK.
The property form shows the properties of the new role.

Viewing Role Properties


A role defines a set of database privileges on database objects. A user who is assigned a role automatically
gains all the privileges of that role. For more information on roles and privileges, see SQL Fundamentals,
SQL Data Control Language, and SQL Data Definition Language - Syntax and Examples.
1. In the Navigator, right-click Roles, and click Show Roles.
A list of the roles defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer, right-click the role you want to view, and click Open Role.
A Role property form for the selected role opens in the Details view.

Modifying Role Properties


A role defines a set of database privileges on database objects. A user who is assigned a role automatically
gains all the privileges of that role. For more information on roles and privileges, see SQL Fundamentals,
SQL Data Control Language, and SQL Data Definition Language - Syntax and Examples.
1. In the Navigator, right-click Roles, and click Show Roles.
A list of the roles defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer, right-click the role you want to modify, and click Modify Role.
A Modify Role property form for the selected role opens in the Details view.
3. Modify properties by entering new information into the property fields.
4. [Optional] Click the SQL tab to see the SQL code that will be executed on the connected system to
modify the role.
5. Click Commit.
6. Click OK to dismiss the confirmation dialog.
A property form shows the modified role properties.

Dataset Schemas
Teradata Database 16.00 supports a new data type called DATASET. A DATASET is a Custom Data Type
(CDT) used to represent self-describing data stored in a format that conforms to a schema. Thus a
DATASET has an associated schema that can be included along with the column data or referenced.

74 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
Schemas are created via a CREATE SCHEMA statement and stored in the SYSUDTLIB database. Schema
information is stored in the DBC.DatasetSchemaInfo table.
Schemas are defined in a storage format. Currently, Apache Avro is the only storage format supported. Avro
is a data serialization framework that uses JSON for defining data types and protocols and serializes data in a
compact binary format. It is used primarily in Apache Hadoop to provide a serialization format for
persistent data and a wire format for communication between Hadoop nodes and from client programs to
the Hadoop services. Schemas can also include CSV defined parameters.

Viewing Dataset Schemas

1. In the Navigator, right-click Dataset Schemas, and click Show Dataset Schemas.
A list of dataset schemas defined in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. In the Object List Viewer, right-click the dataset schema you want to view, and click Open in Dataset
Schema Form.
A property form shows the dataset schema properties.

Creating Dataset Schemas


1. In the Administration perspective, select the Teradata connection.
2. In the Navigator, right-click Dataset Schemas, and click Show Dataset Schemas.
The dataset schemas list opens in the Object List Viewer.
3. In the Object List Viewer toolbar, click .
An Dataset Schema property form opens in the Details view.
4. Click the General category and enter values for the new dataset schema.
5. Click the Dataset Schema Text category and enter or import the schema text.
6. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new dataset schema.
7. Click Commit.
8. Click OK.
The property form shows the properties of the new dataset schema.

Dropping Dataset Schemas


1. In the Navigator, right-click Dataset Schemas, and click Show Dataset Schemas.
A list of the dataset schemas defined in the connected system appears in the Object List Viewer. The list
is filtered according to any filters you have applied.

2. In the Object List Viewer toolbar, select the dataset schema you want to drop and click .
3. Click OK to confirm.

Teradata Studio User Guide, Release 16.00 75


Chapter 3: Database Administration
Teradata Database

Authorization Management

Creating an Authorization
An authorization creates an association between a database user and an OS platform user identification,
allowing external routines to run in secure mode using the context, privileges, and access control granted to
the specified OS user. For more information about authorizations, see SQL Data Definition Language -
Syntax and Examples. For information about the authorization trusted extensions that you use to access
remote systems using QueryGrid, see the Teradata QueryGrid documentation.
1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. In the Object List Viewer, right-click the database or user for which you want to define an
authorization, and click Show Authorizations.
Any authorizations that have been defined for the database or user are listed in the Object List Viewer.

3. In the Object List Viewer toolbar, click .


A Create Authorization property form opens in the Details view.
4. Enter the properties that define your new authorization.
5. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new authorization.
6. Click Commit.
7. Click OK.
A property form shows the new authorization properties.

Viewing Authorization Properties


An authorization creates an association between a database user and an OS platform user identification,
allowing external routines to run in secure mode using the context, privileges, and access control granted to
the specified OS user. For more information about authorizations, see SQL Data Definition Language -
Syntax and Examples. For information about the authorization trusted extensions that you use to access
remote systems using QueryGrid, see the Teradata QueryGrid documentation.
1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. In the Object List Viewer, right-click the database or user for which you want to view an authorization,
and click Show Authorizations.
Any authorizations that have been defined for the database or user are listed in the Object List Viewer.
3. In the Object List Viewer, right-click the authorization for which you want to show properties and click
Open Authorization.
An Authorization property form opens in the Details view.

Modifying Authorization Properties


An authorization creates an association between a database user and an OS platform user identification,
allowing external routines to run in secure mode using the context, privileges, and access control granted to
the specified OS user. For more information about authorizations, see SQL Data Definition Language -

76 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
Syntax and Examples. For information about the authorization trusted extensions that you use to access
remote systems using QueryGrid, see the Teradata QueryGrid documentation.
1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. In the Object List Viewer, right-click the database or user for which you want to modify authorization
properties, and click Show Authorizations.
Any authorizations that have been defined for the database or user are listed in the Object List Viewer.
3. In the Object List Viewer, right-click the authorization for which you want to modify properties and
click Modify Authorization.
A Modify Authorization property form opens in the Details view.
4. Modify properties by entering new information into the property fields.
5. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
modify the authorization.
6. Click Commit.
7. Click OK.
A property form shows the modified authorization properties.

View Management

Creating a View
A view is a virtual table that you can use as a physical table to retrieve data defining columns from
underlying views or tables, or both.
1. In the Navigator, expand the Databases, right-click a database or user, and click Show Views.
A list of the views defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, click .


A Create View property form opens in the Details view.
3. In the form, enter values for the new view.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new view.
5. Click Commit.
6. Click OK.
The property form shows the properties of the new view.

Modifying a View
1. In the Navigator, expand the Databases, right-click a database or user, and click Show Views.
A list of the views defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer, right-click the profile you want to modify, and click Modify View.
A Modify View property form opens in the Details view.
3. Modify properties by entering new information into the property fields.

Teradata Studio User Guide, Release 16.00 77


Chapter 3: Database Administration
Teradata Database
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
modify the view.
5. Click Commit.
The view is modified in the connected database.
6. Click OK.
A property form shows the modified view properties.

Dropping a View
1. In the Navigator, expand the Databases, right-click a database or user, and click Show Views.
A list of the views defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, select the view you want to drop and click .
3. Click OK to confirm.

Teradata Database Browsers

Dependency Browser
The Dependency Browser shows object dependencies within a Teradata Database system. For example, the
browser can discover which objects a specific object references or which objects are referenced by a specific
object.
The Dependency Browser uses Teradata Meta Data Services (MDS) to discover these relationships. The
Dependency Browser communicates with MDS via its web services interface. You must configure the MDS
Administrator to manage the current Teradata database server and configure the Teradata Dependency
Browser with the MDS web service login. Refer to Dependencies Preferences to configure the MDS web
service system and user credentials.
Meta Data Services currently does not support User-defined Functions and User-defined Types. Requests to
return dependent objects for these two object types return an empty list. To resolve other issues when
objects are not returned by the Teradata Dependency Browser, see Meta Data Services Synchronization
Issues.

Dependencies Preferences
The Dependencies Preferences dialog enables you to set the Meta Data Services web service system and
user credentials.

Option Description
Web Service System Specifies the name of the MDS web service system
Port Specifies the port number for the MDS web service
Secure server Selects the HTTPS option when connecting to the MDS web service
User Specifies the MDS User name
Password Specifies the MDS password
Test User Tests the user credentials. A list of available database systems is
displayed in a dialog box.

78 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Option Description
Display Message Sets the display of warning messages generated by the Copy and
Compare features

Interdependency Browser
The Interdependency Browser shows a selected database object and its relationships to other database
objects. A database object is displayed as a rectangle containing the name of the object and the type of the
object. An icon is included to represent the object's type.
A relationship between objects is shown by a connecting line from one object to another. There are two
types of connecting lines:
Line Type Description
Solid Indicates that the object on the arrowhead end of the line is contained
by the other object (such as a database containing a table).
Dashed Indicates that the object references the other object (such as a view
referencing a table).

The selected object initially appears with a gray background and shows the objects that reference the selected
object as well as the objects that it references.

Note:
By default, the diagram does not show columns and parameters.

You can show or remove related objects by using the context menu associated with the object whose
diagram element is currently selected. The current selection is indicated by a bold line outlining the object's
rectangle or the line indicating a relationship between two objects.
The actions that appear in the Interdependency Browser context menus are described in Interdependency
Browser Actions.
Actions that can add or remove objects from the diagram have a check mark next to the action name to
indicate that objects of that type appear in the diagram. Choosing a selected action removes all of the
selected object's references to objects of the action's type. Selecting a cleared action adds the selected object's
references to the objects of the action's type (if any).

Note:
If dependent objects are not returned for the browser, there may be Meta Data Services synchronization
issues that need to be considered. Refer to the Meta Data Services Synchronization Issues page to help
resolve these issues.

Interdependency Browser Actions


The following actions appear in context menus of database objects:

Action Description
Show Object In Object Viewer Details of the selected object appear in the Object Viewer. This action
is unavailable if the object cannot be shown in the Object Viewer.
Show Containing Object Object that contains the selected object appears in the diagram; the
containment relationship line appears between them; and the

Teradata Studio User Guide, Release 16.00 79


Chapter 3: Database Administration
Teradata Database

Action Description
containing object is selected. If the containing object is already in the
diagram but not currently visible, the diagram scrolls until it appears.
Show Default Referring Objects Default set of objects that refer to the selected object appears with the
relationships between them.
Show Default Referred To Default set of objects to which the selected object refers appears in the
Objects diagram with the relationships between them.
Show Columns Columns contained in the selected object are added or removed. In the
case of views, the tables columns that the view references also appear.
Show Constraints Table primary key, foreign keys, and check constraints are added or
removed.
Show Indexes Indexes of the selected table or database are added or removed.
Show Macros Macros of the selected database are added or removed.
Show Parameters Parameters of the selected stored procedure or macro are added or
removed.
Show Databases Databases of the selected database system are added or removed.
Show Stored Procedures Stored procedures of the selected database are added or removed.
Show Tables Tables referenced by the selected object are added or removed. This
action is available for databases (to show the tables it contains) and
objects that reference tables (such as views and macros).
Show Triggers Triggers referenced by the selected object are added or removed. This
action is available for databases (to show the triggers it contains),
tables (to show the triggers of the table), and columns (to show the
triggers that occur on updates to the selected column).
Show Stored Procedures Stored procedures referenced by the selected object are added or
removed. This action is available for databases (to show the stored
procedures it contains) and objects that reference stored procedures
(such as stored procedures and macros).
Show UDFs User-defined functions contained in the selected databases are added
or removed. (Currently user-defined functions are not indexed by
Meta Data Services so other references to them are not available.)
Show UDTs User-defined types contained in the selected database are added or
removed. (Currently user-defined types are not indexed by Meta Data
Services so other references to them are not available.)
Show Views Views referenced by the selected object are added or removed. This
action is available for databases (to show the views it contains) and
objects that reference views (such as stored procedures, views, and
macros).

The following actions appear in context menus of relationship lines:

80 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Action Description
Show Referring Object Referring object is selected and scrolled into view if it is not already
visible.
Show Referred Object Object being referred is selected and scrolled into view if it is not
already visible.

Interdependency Printing
The Interdependency Browser diagram is compact. Elements of the diagram are moved around to
minimize the length of lines connecting the elements. There is no special arrangement to lay the diagram out
for printing. As a result, diagram elements might be split between multiple pages.
There are some printer drivers that don't handle the icons in the diagrams very well. If the icons don't appear
in the printed diagrams, check the printer's preferences to see if there is a setting that enables the printing of
the icons. For example, a printer driver that exhibits the problem has a setting to print in "Raster Mode."
Using this Raster Mode results in the icons being printed.

Macro Management

Creating a Macro
Macros are SQL statements that the server stores and executes. Macros provide an easy way to execute
frequently used SQL operations.
1. In the Navigator, expand the Databases, right-click a database or user, and click Show Macros.
A list of the macros defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, click .


A Create Macro property form opens in the Details view.
3. In the form, enter values for the new macro.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new macro.
5. Click Commit.
6. Click OK.
The property form shows the properties of the new macro.

Dropping a Macro
1. In the Navigator, expand the Databases, right-click a database or user, and click Show Macros.
A list of the macros defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, select the macro you want to drop and click .
3. Click OK to confirm.

Teradata Studio User Guide, Release 16.00 81


Chapter 3: Database Administration
Teradata Database

Stored Procedure Management

Creating a Stored Procedure


Store procedures allow you to build complicated applications through a variety of features.
1. In the Navigator, expand the Databases, right-click a database or user, and click Show Procedures.
A list of the procedures defined in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.

2. In the Object List Viewer toolbar, click .


A Create Procedures property form opens in the Details view.
3. In the form, enter values for the new stored procedure.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new procedure.
5. Click Commit.
6. Click OK.
The property form shows the properties of the new stored procedure.

Dropping a Stored Procedure


1. In the Navigator, expand the Databases, right-click a database or user, and click Show Procedures.
A list of the stored procedures defined in the connected system appears in the Object List Viewer. The
list is filtered according to any filters you have applied.

2. In the Object List Viewer toolbar, select the procedure you want to drop and click .
3. Click OK to confirm.

User-Defined Function (UDF) Management

Creating a UDF
Teradata allows you to create UDFs to extend your SQL functionality.
1. In the Navigator, expand the Databases, right-click a database or user, and click Show User-Defined
Functions.
A list of the UDFs defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, click .


A Create User-Defined Function property form opens in the Details view.
3. In the form, enter values for the new UDF.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new UDF.
5. Click Commit.
6. Click OK.
The property form shows the properties of the new UDF.

82 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
Dropping a UDF
1. In the Navigator, expand the Databases, right-click a database or user, and click Show User-Defined
Functions.
A list of the UDFs defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, select the UDF you want to drop and click .
3. Click OK to confirm.

User-Defined Type (UDT) Management

Creating an Array UDT


Teradata allows you to create user-defined data types (UDTs) to extend your SQL functionality.
An Array is a type of UDT that can represent up to five dimensions, each with a user-defined maximum
number of individual elements. All of the elements of an array must be of the same data type.
1. In the Navigator, expand the Databases, right-click the SYSUDTLIB database, and click Show User-
Defined Types.
A list of the UDTs defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer toolbar, click .
An Array User Defined Type property form opens in the Details view.
3. Click the General category and enter values for the new UDT.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new UDT.
5. Click Commit.
6. Click OK.
The property form shows the properties of the new UDT.

Creating a Distinct UDT


Teradata allows you to create user-defined data types (UDTs) to extend your SQL functionality.
A distinct UDT is mapped to a single predefined Teradata data type.For example, a Euro UDT might be
based on the predefined data type DECIMAL, but it would stand alone as a distinct data type.
1. In the Navigator, expand the Databases, right-click the SYSUDTLIB database, and click Show User-
Defined Types.
A list of the UDTs defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer toolbar, click .
A Distinct User Defined Type property form opens in the Details view.
3. Click the General category and enter values for the new UDT.
4. Click the Options category and enter values for the new UDT.

Teradata Studio User Guide, Release 16.00 83


Chapter 3: Database Administration
Teradata Database
5. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new UDT.
6. Click OK.
The property form shows the properties of the new UDT.

Creating a Structured UDT


Teradata allows you to create user-defined data types (UDTs) to extend your SQL functionality.
A structured UDT can have one or more attributes that can be based on predefined types or other UDTs.
For example, an Address UDT might have street number, street name, city, state and zip code as attributes.
1. In the Navigator, expand the Databases, right-click the SYSUDTLIB database, and click Show User-
Defined Types.
A list of the UDTs defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.
2. In the Object List Viewer toolbar, click .
A Structured User Defined Type property form opens in the Details view.
3. Click the General category and enter values for the new UDT.
4. Click the Attributes category and enter values for the new UDT.
5. Click the Options category and enter values for the new UDT.
6. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
create the new UDT.
7. Click OK.
The property form shows the properties of the new UDT.

Dropping a UDT
1. In the Navigator, expand the Databases, right-click a database or user, and click Show User-Defined
Types.
A list of the UDTs defined in the connected system appears in the Object List Viewer. The list is filtered
according to any filters you have applied.

2. In the Object List Viewer toolbar, select the UDT you want to drop and click .
3. Click OK to confirm.

Rights Management

Connect Through Rights


The Connect Through Rights dialog enables you to grant, revoke, and display connect through privileges
on trusted database users in its two tabs. Access this option by right-clicking a user in the Data Source
Explorer and selecting Teradata > Grant/Revoke > Connect Through Rights.

Grant/Revoke Tab
Use this tab to select the trusted database users for which to set connect through rights.

84 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Tabs Description
Trusted User Select the database user that you want proxy users to connect through.
Trust Only Check to grant connect through with trust-only option.
Grant Grant connect through privileges to application or permanent proxy users.
• Application Proxy Users tab - Grant privileges to an application user
(non-database defined) who is allowed to connect through the selected
trusted user.
• Permanent Proxy Users tab - Grant privileges to a permanent user
(database defined) who is allowed to connect through the selected
trusted user.

Revoke Revoke connect through privileges to an application or permanent proxy


users.
Display Display the current connect through privileges for the selected trusted user.

SQL Preview
Use the SQL Preview tab to preview the generated SQL statements submitted when you click Grant or
Revoke. The generated SQL updates whenever you move privilege items to the To be granted or To be
revoked list. You can save the SQL to a project by using the Save SQL option in the SQL Preview tab.

Permanent Proxy Users Tab


The Permanent Proxy Users tab enables you to grant connect through privileges to permanent proxy users.
Permanent proxy users are users who are defined in the Teradata or Aster database and allowed to connect
through a trusted user.
The tab displays current grantable privileges based on the selected user in Trusted User. You can move
single or multiple privilege type(s) from the Grantable Privileges list to To be Granted privileges list to
specify which privileges to grant. You must click Grant to grant the connect through rights to the user.
1. In User(s), select the users to whom you want to grant connect through privileges.
2. Select Roles and then select up to 15 roles that can be used by the Trusted User when the database-
defined users connect through.
3. Click Add To to add the permanent proxy user name and role to the Grantable Privileges list.
4. In Grantable Privileges, review and then select the privileges to grant.
Use the Shift and Ctrl keys to select multiple privileges.
5. Move single or multiple privileges from the Grantable Privileges list to the To be Granted list using the
directional arrows.
The single arrow moves a single privilege; the double arrow moves multiple privileges.
6. Preview the generated SQL statement in the SQL Preview tab, and if necessary, repeat previous steps to
modify SQL.
7. Click Grant to submit SQL and grant privileges listed in the To be Granted list.

Teradata Studio User Guide, Release 16.00 85


Chapter 3: Database Administration
Teradata Database
Application Proxy Users Tab
The Application Proxy Users tab enables you to grant connect through privileges to application proxy
users. Application proxy users are application users who are not defined in the Teradata or Aster database
and who are allowed to connect through a trusted user.
The tab displays current grantable privileges based on the selected application user. You can move single or
multiple privilege type(s) from the Grantable Privileges list to the To be Granted privileges list to specify
which connect through privileges to grant. You must click Grant to grant the connect through privileges to
the user.
1. In Application User(s), enter user names (separated by commas) to define the application proxy users.
2. In Roles, select up to 15 roles that the Trusted User can use when the DBS/Application users connect
through.
3. Click Add To to add the proxy user name and role to the Grantable Privileges list.
4. In Grantable Privileges, review and then select the privileges to grant.
Use the Shift and Ctrl keys to select multiple privileges.
5. Move single or multiple privileges from the Grantable Privileges list to the To be Granted list using the
directional arrows.
The single arrow moves a single privilege; the double arrow moves multiple privileges.
6. Preview the generated SQL statement in the SQL Preview tab, and if necessary, repeat previous steps to
modify SQL.
7. Click Grant to submit SQL and grant privileges listed in the To be Granted list.

Display Tab
The Display tab shows a detailed grid of the current connect through privileges for the selected Trusted
User. You must select a database user from the Trusted User field to refresh the Details grid.

Revoke Tab
The Revoke tab shows the list of revocable connect through privileges for a trusted user and lets you specify
which privileges to revoke. You must click Revoke to revoke privileges on the trusted user you select. The
Revoke tab contains two lists:
List Description
Revocable Privileges Lists current revocable privileges on the selected trusted user.
To be Revoked Lists the privileges you selected to be revoked for trusted users.

You move privileges from the Revocable Privileges list to the To be Revoked list to indicate which
privileges are to be revoked for the selected trusted user.
1. In Revocable Privileges, review and then select the privileges to revoke on the trusted user you selected.
Use the Shift and Ctrl keys to select multiple privileges.
2. Move single or multiple privileges from the Revocable Privileges list to the To be Revoked list using the
directional arrows.
The single arrow moves a single privilege; the double arrow moves multiple privileges.
3. Click Revoke to revoke privileges on the trusted users listed in the To be Revoked list.

86 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
SQL Preview Tab
The SQL Preview tab displays the generated SQL GRANT and REVOKE statements required to create grant
and revoke privileges on trusted users. The text in the Generated SQL region of the tab is red if the
definition is incomplete or contains an error.
1. In Generated SQL, review the generated SQL statements.
2. [Optional] Click the Grant/Revoke tab to change the granted or revoked privileges defined in the SQL
statement.
Any changes you make automatically generate new SQL for your review.
3. Click any displayed error links below the generated SQL and correct the errors.
Error messages link to the field that contains the error.
4. Choose one of the following:

Option Description
Save SQL Saves the SQL statement to an SQL file in an existing project in your workspace. The
Save SQL dialog opens. Select a project folder and type a file name, then click OK.
Show in Editor Displays the SQL statement in the SQL Editor. The Connect Through Rights dialog
is not closed.

Logon Rights
The Logon Rights dialog enables you to grant, revoke, and display log-on privileges assigned to database
users. Access this option by right-clicking a user in the Data Source Explorer and selecting Teradata >
Grant/Revoke > Logon Rights.

Grant/Revoke Tab
Use this tab to select the trusted database users for which to set logon rights.

Option Description
All Users (Default) Selects to grant, revoke, or display log-on rights on All database users.
Specific Users(s) Selects to grant, revoke, or display log-on rights on specific database users.
The log-on rights granted or revoked on specific users take precedence over
the rights granted or revoked on all users (default).
View Details Updates the Grant, Revoke, and Display tabs with the log-on right details
based on selection of database objects.
Filter Host ID Views only those log-on rights on HostIDs you select from the Filter
Hostid combo box. Information for the selected HostIDs display in the
Grant, Revoke, and Display tabs.
Grant Tab Grant log-on privileges to all database users (default) or specific database
users.
Revoke Tab Revoke log-on privileges from database users.
Display Tab Display the current log-on privileges for the selected database user.
Null Password Select this if no password is required for the user to log on.

Teradata Studio User Guide, Release 16.00 87


Chapter 3: Database Administration
Teradata Database
SQL Preview Tab
The SQL Preview tab previews the generated SQL before you submit the request. To execute the SQL
statement, click Grant or Revoke. To modify the generated SQL, go to the Grant or Revoke tabs and make
changes. The SQL updates when you move privileges to or from either 'To be granted' or 'To be revoked'.
You can save the generated SQL to an SQL file in a project by clicking Save SQL.

Display Tab
The Display tab contains a Details tab that displays the current privileges for the selected database object
when you click View Details.

Revoke Tab
The Revoke tab displays privileges you can revoke for the specified database user and HostID. To revoke a
privilege, move it to the To be revoked list and click Revoke. The Revoke tab contains two lists:
List Type Description
Revocable Privileges Lists current revocable privileges on the selected users.
To be Revoked Lists the privileges you selected to be revoked for selected users.

You move privileges from the Revocable Privileges list to the To be Revoked list to indicate which
privileges are to be revoked for the selected users.
1. In Revocable Privileges, review and then select the privileges to revoke on the users you selected.
Use the Shift and Ctrl keys to select multiple privileges.
2. Move single or multiple privileges from the Revocable Privileges list to the To be Revoked list using the
directional arrows.
The single arrow moves a single privilege; the double arrow moves multiple privileges.
3. Click Revoke to revoke privileges on the users listed in the To be Revoked list.

Grant Tab
The Grant tab displays privileges you can grant to the specified database user or object. The Grantable
Privileges list displays the current grantable privileges on the selected database object and HostId. To grant
a privilege, move it from Grantable Privileges to the To be granted list and click Grant.
1. In Grantable Privileges, review and then select the privileges to grant on objects you selected in the To/
From Objects section of the dialog.
Use the Shift and Ctrl keys to select multiple privileges.
2. Move single or multiple privileges from the Grantable Privileges list to the To be granted list using the
directional arrows.
The single arrow moves a single privilege; the double arrow moves multiple privileges.
3. [Optional] Under Options select Null Password if you want the database user to have a logon string
with no passwords be accepted from the specified host.
This option implies that the user has been authenticated externally and not by the database.
4. Preview the generated SQL statement in the SQL Preview tab and if necessary, repeat previous steps to
modify SQL.
5. Click Grant to submit SQL and grant privileges on the objects listed in the To be granted list.

88 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
SQL Preview Tab
The SQL Preview tab displays the SQL DDL statement generated by the selections in the Grant and Revoke
tabs. You can save the SQL or view the statement in an SQL editor.

Option Description
Save SQL Chooses a file in which to save the SQL.
Show In Editor Views the SQL in the SQL Editor. The Logon Rights dialog remains open.

Access Logging Rules


The Access Logging Rules dialog enables you to begin or end access logging on specific databases or users
and view the access logging rules based on selected criteria.

Display Access Logging Tab


The Display Access Logging tab enables you to view access logging rules and display customized Rules
reports based on your selected criteria.
1. Under Rule Type indicate which existing access logging rules to display:

Option Description
By User View rules grouped by users.
On Database View rules grouped by database.
On User View rules for a user.
2. Click Display to show the access logging rules.
3. Under Logging Rules, right-click any table header and select one of these actions:

Option Description
Select to Modify Types Selects list items in the Set Access Logging tab for further modification of
logging details.
Select All Selects all items in the list.
Copy Copies all selected items to a clipboard.

The Rules Report displays the access logging rules report for the selected criteria.

Set Access Logging Tab


The Set Access Logging tab enables you to configure access logging rules for user and database objects.
Create or remove access logging on an object by specifying the target object and then clicking either Begin
Log or End Log.
1. Under By User select one of the following:
Option Description
All Users Creates an access logging rule that applies to all users on the database.

Teradata Studio User Guide, Release 16.00 89


Chapter 3: Database Administration
Teradata Database

Option Description
Specific User(s) Creates an access logging rule that applies to specific users. Select a user from
the list. To select multiple users, use the Shift and Ctrl keys.
2. [Optional] Select Denials to create a rule that only applies when access is denied.
You can define two rules for the same user and object, but with different Denials settings.
3. [Optional] Select With SQL to record SQL statements in the access log.
4. Under Frequency select one of the following:
Option Description
First Logs only the first access by selected user(s) to the selected object.
Last Logs only the last access by selected user(s) to the selected object.
Each Logs every access by selected user(s) to the selected object.
First & Last Logs only the selected user(s) first and last access to the selected object.
5. Under On Object select one of the following:
Option Description
All Sets a rule that applies to all database and user objects.
Database Sets a rule that applies to objects on the selected database. Use the drop-down
list to select a database available for access logging.
User Sets a rule that applies to objects on the selected user. Use the drop-down list
to select a user available for access logging.
Authentication Sets a rule that applies to the selected authentication name. Use the drop-
down list to select a name.
6. [Optional] If you selected Database or User in the previous step, select Object Type to create or remove
an access logging rule for a specific object on the selected database or user.
a) Use the list to select the object type of the target object.
b) Use the second list to select the target object on which you want to create or remove the role.
7. [Optional] Select specific SQL statements to log.
You can manually select individual SQL statements or use the Select By options to group related SQL
statements to log.
a) Under Select By, select one or more of the following:
Option Description
All Selects all available commands for logging.
Dictionary Selects all available dictionary commands for access logging.
Create Selects all available create object rights for access logging; automatically
selected if you select Dictionary.
Drop Selects all available drop object rights for access logging; automatically
selected if you select Dictionary.
Access Selects all available access commands for access logging.

90 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Option Description
Drop Selects all available maintenance commands for access logging.
b) Under Normal select from the list of basic SQL access statements to log.
c) Under Create select from the list of SQL CREATE statements to log.
d) Under Drop select the SQL DROP statements to log.
8. Click one of the following buttons:
Button Description
Begin Log Defines an access logging rule for the selected user(s), database, and object
(optional).
End Log Revokes an existing access logging rule for the selected user(s), database, and object
(optional).

Viewing Access Logging Rules


Access logging keeps a record of database and user access. Access logging rules set the criteria for what to
log.
1. In the Data Source Explorer, right-click a database or user, and click Teradata > Logging > Access
Logging
The Access Logging Rules dialog opens.
2. Click the Display Access Logging tab.
3. From the Rule Type options, choose the type of rules you want to display.
Users or databases that have associated access logging rules defined are displayed in box.
4. Select the user or database for which you want to display access logging rules (you can select more than
one), and click Display.
Access logging rules that have been defined for the selected database or users are displayed in the
Logging Rules table.

Setting Access Logging Rules


Access logging keeps a record of database and user access. Access logging rules set the criteria for what to
log.
1. In the Data Source Explorer, right-click a database or user, and click Teradata > Logging > Access
Logging
The Access Logging Rules dialog opens.
2. On the Set Access Logging tab, specify the parameters and scope of the access logging you want
Teradata Database to record.
An access logging rule can specify to log accesses by all or specific users, to all or specific databases and
users. It can log accesses to all objects in a database or user, or to a specific object. You can specify the
type of access according to several criteria. Use the Select By options to select entire categories of access
types.
3. Click Begin Log to create your access logging rule and begin logging.
An Access Logging Rules message confirms that the logging rule was created successfully.
4. Click OK.
Access logging using the new rule begins.

Teradata Studio User Guide, Release 16.00 91


Chapter 3: Database Administration
Teradata Database
Query Logging Rules
The Query Logging Rules dialog enables you to begin, end, and delete query logging for Application(s),
All Users or any Specific User(s) and view the query logging rules based on selected criteria.

Display Query Logging Rules


The Display Query Logging tab contains the following fields:

Rule Type

Option Description
Application Name Views the existing query logging rules for applications.
All Users Views the existing query logging rules for All users.
Specific User(s) Views the existing query logging rules for specific users.
Display Displays the query logging rules for the selected criteria.
Modify Query Logging Enabled when you select Specific User(s). Select the selected list items in the Set
Query Logging tab to further modify logging details.
Select All Selects all items in the list.
Copy Copies all selected items to clipboard.

Logging Rules

Option Description
Rules Report Displays the query logging rules report for the selected criteria.

Set Query Logging Tab


The Set Query Logging tab contains the following fields.

Rule Type

Option Description
Application Name Creates a rule by application name. Type the application name in the text box
located directly below the check box. You can also enter single or multiple
application names by separating names with a comma (,). This check box is
only available when connected to Teradata Database 13.00.00 and later.
All Users Creates a query logging rule that applies to all users. Type one or more
Account names, separated by commas. All users are restricted to logging on to
only those sessions for the specified accounts.
Specific User(s) Selects users from the list of all users in the database to create a query logging
rule for one or more users. Type one or more Account names, separated by
commas. All users are restricted to logging on to only those sessions for the
specified accounts.

92 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
Mode Option

Option Description
Mode Controls which CPU/IO collection algorithm Teradata Database uses for this
query logging rule.

What to Log

Option Description
No Logging Exempts one or more users from logging when these users would otherwise be
logged by a broader rule such as All Users or Account. This check box is only
available when connected to Teradata Database 13.00.00 and later.
Object Names References the names of the database objects (Tables, Views, and so forth.) in
the query to be saved to the DBQLObjTbl table.
Full SQL Text Saves the full SQL text to the DBQLSQLTbl table (besides what is specified in
the SQL Length field).
Step Information Logs the statistics for each execution step within the queries to the
DBQLStepTbl table.
Explain Text Saves the Explain text for the queries to the DBQLExplainTbl table.
Usercount Logs the user count for queries.
XML Plan Adds XML Plan information to the Query Log for later use by the DBQAT
products. Select the Verbose option if you want detailed information entered
in the log.
Statistics Usage Logs query statistics. If you want to log detailed statistics, select Detail.
Lock Logs information about query locks.
Everything Logs all possible options.

Limits

Option Description
SQL Length Limits the length of the SQL stored in the main query logging table:
DBQLLogTbl. The maximum length is 10,000 characters. If you do not select
this option, the Teradata Database logs the first 200 characters of the SQL.
Summary Logs only summary statistics for the executed queries. Enter 3 threshold values.
These values define thresholds (seconds) for query response time. They are
used to group queries into 4 'size' categories.
A count of the number of queries in each category is logged every 10 minutes.
For example: If the three threshold values entered are 5, 10 and 15, counts for
the queries that run between 0 and 5 seconds, 5 to 10 seconds, 10 to 15 seconds
and above 15 are logged.
Every 10 minutes, a DBQL object row is written for any count that is greater
than 0. For example, if 1 query ran under 5 seconds, 2 queries each ran 7
seconds, and 3 queries each ran over 15 seconds, 3 rows are written to the

Teradata Studio User Guide, Release 16.00 93


Chapter 3: Database Administration
Teradata Database

Option Description
DBQL object table. When you select Summary, none of the other dialog
options apply.
Threshold Counts those queries that run in less than n seconds (in the summary record
written every 10 minutes). Queries that run longer than n seconds are logged
using the other settings.
Elapsed (sec) Specifies the content of the Summary and Threshold fields. Elapsed (sec) is
Elapsed (1/100) the default.
CPU Time
CPU (Normalized)
I/O Count

Viewing Query Logging Rules


The Database Query Log (DBQL) stores historical records of queries, together with their duration,
performance, and target activity, based on rules you define.
1. In the Data Source Explorer, right-click a database or user, and click Teradata > Logging > Query
Logging
The Query Logging Rules dialog opens.
2. Click the Display Query Logging tab.
3. From the Rule Type options, choose the application or users for which you want to display query log
rules.
Applications or users that have associated query logging rules defined are displayed in box.
4. Select the application or database users for which you want to display query logging rules (you can select
more than one), and click Display.
Query logging rules that have been defined for the selected application or users are displayed in the
Logging Rules table.

Setting Query Logging Rules


The Database Query Log (DBQL) stores historical records of queries, together with their duration,
performance, and target activity, based on rules you define.
1. In the Data Source Explorer, right-click a database or user, and click Teradata > Logging > Query
Logging
The Query Logging Rules dialog opens.
2. On the Set Query Logging tab, specify the criteria for the query logging you want Teradata Database to
record.
You can log queries issued by a specific application, one or more users or databases, or one or more
database accounts. Query logging rules can specify what to log (such as object names, SQL text,
EXPLAIN text), and you can set parameters to limit the logging and save space.
3. Click Begin Log to create your query logging rule and begin logging.
A QueryLogging Rules message confirms that the logging rule was created successfully.
4. Click OK.
Query logging using the new rule begins.

94 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Move Space
The Move Space form enables you to move permanent space from one database to another.

Option Description
From Database Select a database from the list of databases defined in the system. Space from the
database you select is moved to the database you select in To Database.
To Database Select a database from the list of databases defined in the system. The database you
select in this list receives the space moved out of the database you selected in
From Database.
Bytes To Move Shows the bytes of space to move between the selected databases. The unit
denomination depends on whether the KB, MB, GB, or TB button has been
selected. You can change the value in the Bytes to Move field by typing the value,
clicking the up/down arrows to the right of the value, or by adjusting the
Percentage to Move slider (see below).
Percent to Move Provides an alternate way to specify the amount of space to move. The position of
the pointer shows the portion of the From Database free space to move to the
database specified in To Database. When you adjust the position of the slider, the
amount of space to move is shown in the Bytes to Move field.
Allocations Displays a table that shows the allocation of used and free space of the selected
databases. The values display in the units of the selected KB, MB, GB, or TB
button. The table shows both the used and free space for the to and from
databases, before and after the selected move is executed.

The message area at the top of the form indicates whether enough information is specified to move space
from one database to another. If not, a red X icon displays with a message explaining what must be done.
Click the Commit button to execute the contents of this property form.

Moving Spacing Between Databases and Users


You can move PERM space between databases and users.
1. In the Navigator, right-click Databases and click Show Databases.
A list of the databases and users in the connected system appears in the Object List Viewer. The list is
filtered according to any filters you have applied.
2. In the Object List Viewer, right-click the database or user from which you want to move space, and click
Move Space.
3. In the property form, enter how much space to move and choose the destination database or user.
4. [Optional] Click the SQL category to see the SQL code that will be executed on the connected system to
accomplish the move.
5. Click Commit.
The space is transferred, and a dialog opens to confirm the operation.
6. Click OK.

Teradata Studio User Guide, Release 16.00 95


Chapter 3: Database Administration
Teradata Database

Object Space
Every object has a certain amount space allocated to it, and can have one or more associated artifacts (an
artifact refers to an attached file or jar file). You can view information for an object by right-clicking it (in
the Object List Viewer) and selecting one of the following commands from the pop-up menu:

Command Description
Show Summary Object Space Total perm space allocated to a selected table. The Show Summary
Object Space command displays current perm space, peak perm space
and skew factor.
Show Object Space Total perm space allocated to the selected object. For a table, this is
shown per VProc. The Show Object Space command displays current
perm space, peak perm space, type, skew factor, creator name and
comment string.
Show Created Space Total perm space allocated to all objects created by the selected user.
The Show Created Space command displays current perm space, peak
perm space, type and create time.
Show Child Space Total perm space allocated to all children of the selected object. The
Show Child Space command displays current perm space, peak perm
space, type, skew factor, creator name and comment string.
Show Files List of all files associated with the selected object.
Show Jar Files List of all jar files associated with the selected object.

You can also view space information on the Database, User, and Table Property Forms.

Data Tools

Compare Objects
If you selected a database, user or table object to compare, and it has dependent objects you want to include
in the comparison, select these objects in the Compare Objects screen. If an object has no dependent
objects, the screen displays as blank.
Including dependent objects is an optional step. By default, the Compare SQL Object Wizard compares
only the object you select with the referenced object.

Dependent Objects
You can include dependent objects to be included in the comparison of database, user, and table objects.
When comparing database or user objects, the Compare SQL Object Wizard gives you the option to
include child databases and users, functions, hash and join indexes, macros, stored procedures, tables,
triggers, and views. If you are comparing tables, you can include dependent triggers in the DDL comparison.

About Comparing Objects


You can compare the Data Definition Language (DDL) text of two database objects of the same type. You
can compare Teradata Database objects with other Teradata objects of the same type, and Aster objects with
other Aster objects of the same type.

96 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
The wizard guides you through the selection of the object you want to compare. Depending on the object
type you selected in the Data Source Explorer, the wizard helps you to select an object of the same type. For
example, if you select a Table object in Data Source Explorer, you are allowed to only choose a Table object
to compare with it.
Optionally for Teradata objects you can choose to include any dependent objects in the DDL comparison.
For example, you can include Tables in a database comparison, and triggers in a Table comparison.
When you click Finish the Compare Editor appears and displays the DDL text of the referenced object and
the compare-to object side-by-side. You can use toolbar functions to view the DDL differences and changed
elements. You can also edit the text but you cannot move text from one editor window to the other.

Teradata Compare Objects View


The Compare Objects View provides a tree view of a Teradata database that you can use for copying and
comparing database objects. To compare objects, you first select the profile for comparison from the
selection list of connected profiles. You can then drag database objects from the Data Source Explorer and
drop on an object in the Compare View. If the drop is accepted, a Copy and Compare dialog opens and
enables you to copy objects or compare object definitions.
If the Compare View is not visible, you can select Window > Show View > Other > Teradata > Teradata
Compare View from the main menu, or right-click the object or folder in the Data Source Explorer and
select Open > Teradata Compare View in the Teradata menu.
If the compare tree becomes stale, you can refresh the tree by right-clicking within the compare tree and
selecting Refresh Tree.

Types of Objects to Compare


You can only compare database objects of the same type in either a Teradata Database or Aster Database.
You can select the following types of objects in the Data Source Explorer to compare in the Compare
Editor:
Database Type You can compare
Aster Database • Table
• Map Reduce Function
• View

Teradata Database • Database


• User
• Table
• Macro
• Stored Procedure
• Index
• User-defined Function
• User-defined Type (for UDT databases)
• View

You cannot compare Teradata database objects to Aster database objects.

Teradata Studio User Guide, Release 16.00 97


Chapter 3: Database Administration
Teradata Database
Comparing Database and User Objects in Teradata
You can compare the Data Definition Language (DDL) text of two Teradata Database/User objects. You
must be able to connect to the Teradata Databases where the objects are stored.
1. Open the Data Source Explorer and navigate to the Database or User object you want referenced in the
comparison.
This object is called the referenced object.
2. Right-click the object and select Teradata > Compare With.
3. Select a profile from the Select Connection Profile list.
The list shows Connection Profiles to which you are currently connected. If you do not see the profile
you need, go to the Data Source Explorer and right-click Database Connections to connect to the
correct profile.
4. Use the expanded Database navigation tree to select the Database/User object with which you want to
compare.
This object is called the compared to object.
5. Click Next to select additional objects to include in the comparison.
6. Select additional objects you want to include in the comparison by checking the box beside it.
If the database contains no other objects, such as tables or functions, to include in the comparison, the
Compare Objects screen is blank.
7. Click Finish.
Results of the object DDL text comparison display in the Compare View.

Comparing Table Objects in Teradata


You can compare the Data Definition Language (DDL) text of two Teradata table objects. You must be able
to connect to the Teradata Databases where the objects are stored.
1. Open the Data Source Explorer and navigate to the Table object you want to use for the comparison.
This object is called the referenced object.
2. Right-click the referenced object and select Teradata > Compare With.
3. Select a profile from the Select Connection Profile list.
The list shows Connection Profiles to which you are currently connected. If you do not see the profile
you need, go to the Data Source Explorer and right-click Database Connections to connect to the
correct profile.
4. Use the expanded Database navigation tree to select the database that contains the table with which to
compare.
If you select a database that does not contain tables, the message "No Tables" displays below the database
list.

98 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
5. Select a table object from the Table list.
This object is called the compared to object.
6. Click Next to select additional objects to include in the comparison.
7. Select additional objects you want to include in the comparison by checking the box beside it.
If the table does not contain other objects such as triggers, the Compare Objects screen is blank.
8. Click Finish.
Results of the object DDL text comparison display in the Compare View.

About the Compare Editor


The Compare Editor compares the Data Definition Language (DDL) text of two database objects and shows
the DDL for each object side-by-side in a split window. Any differences in text or changed elements between
the two objects are high-lighted in the editor. You can browse the text or use the toolbar to review next/
previous differences and next/previous changed elements.
Types of objects you can compare are:
• Database
• User
• Table
• Stored Procedure
• Macro
• User-defined Function
• View
The following is an example of a comparison of the DDL text of two compared databases in the Compare
Editor.

Teradata Studio User Guide, Release 16.00 99


Chapter 3: Database Administration
Teradata Database

The following is an example of the DDL text comparison for two table objects.

Referenced Object
The object you selected in the Data Source Explorer as the object to compare with another object. The
Compare SQL Objects Wizard presents only objects for comparison that are the same object type as
the referenced object. The DDL text for this object displays in the left pane of the Compare Editor.

Compared to Object
The object you selected in the Compare SQL Objects Wizard for comparison with the referenced
object. The DDL text for this object displays in the right pane of the Compare Editor.
Next and Previous Differences

The Next Difference and Previous Difference functions in the toolbar allow you to review the
differences between the two displayed objects in sequence of occurrence. The editor highlights the next
or previous difference as you review and compare the DDL text in the two object panes.
Next and Previous Change

The Next Change and Previous Change functions in the toolbar allow you to review element
changes in the two compared objects. The editor highlights the next or previous change as you review
and compare the DDL elements.

100 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database
About Launching the Compare Editor
The Compare Editor launches when you select a compare-to object in the Compare SQL Object Wizard
and click Finish.

Compare Editor Toolbar


The Compare Editor toolbar is located in the upper-right corner of the view. Use toolbar functions to show
the next and previous versions of differences and element changes in the compared Data Definition
Language (DDL) text.

Icon Option Description


Next Difference Highlights the difference that follows the current selection point in
the compared DDL text.
Previous Difference Highlights the difference that precedes the current selection point
in the DDL text.
Next Change Highlights the changed element that occurs next in the compared
DDL text.
Previous Change Highlights the changed element that occurs before the current
selection point in the compared DDL text.

Additional functions are available during comparisons:

Option Description
Go to the beginning of the Moves the comparison position to the beginning of the element.
element
Display the next element Moves the comparison position to the next changed element.
Do nothing Retains your compare position at the end of the text.

Statistics

Statistics Collection View


The Statistics Collection view lets you collect statistics on table columns and indexes. Collecting statistics
on columns or indexes is important to producing query plans. You can think of the view as a container that
holds statistics collection objects prior to running the actual collect statistics SQL command on the
collection objects.
This view is provided as a way for you to collect statistics on the required collection objects.
Options shown below are available for adding columns or indexes to the statistics view.

Teradata Studio User Guide, Release 16.00 101


Chapter 3: Database Administration
Teradata Database

Option Description
Right-click menu options from Data Selects table columns or indexes from the Data Source
Source Explorer Explorer to add a column or index in the Statistics Collection
view by right-clicking and selecting Teradata > Statistics >
Collect.
Drag and drop to Statistics Collection Selects columns or indexes from the Data Source Explorer to
View drag and drop the selected items into the Statistics Collection
Objects view.

After you add statistics collection objects, you can manage the objects using the Collect, Add Multi-
Column, and Remove options.

102 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Option Description
Collect Opens the Collect Statistics dialog which allows user to run the Collect
Statistics SQL command on the statistics collection objects added to the view.
Add Multi-Column Selects multiple columns from the statistics collection objects and creates a
multi-column statistic object.
Remove Selects single or multiple items from the statistics collection objects and
removes selected items.
Remove All Removes all items from the statistics collection objects.

Collect Statistics Wizard


The Collect Statistics wizard automatically generates and runs the collect statistics SQL on selected
columns, multi-column, and index collection objects. The dialog also allows you to edit the various collect
statistics SQL parameters before running the SQL on the collection objects. By default the wizard only
generates index-style collect statistics SQL which is the most recommended syntax to be used for Teradata
Database version 14.0 and above.
You can launch the dialog from the Collect Statistics view by clicking Collect.

These options are available for collecting statistics on columns, multi-column, and indexes. You can click
individual cells in the grid report to edit these values:
Option Description
Collection Displays the columns or index objects on which the statistics are collected. The
Objects collection objects are displayed using databasename.tablename.column or
databasename.tablename.index format.
Existing Statistics Displays a check mark when the collection objects already have statistics defined on
them
Partitioned Automatically selected if the column is partitioned. Select or clear the check box to
modify the partitioned column setting before running collect statistics SQL.

Teradata Studio User Guide, Release 16.00 103


Chapter 3: Database Administration
Teradata Database

Option Description
Name The name of a Statistic. After a name is defined, the name can be used in other
operations such as DROP and SHOW STATISTICS. The naming of statistics is
particularly helpful for multi-column statistics.
Max Value Statistics Histogram records values such as min, max, mode and biased values. The
Length Max Value Length refers to the maximum value length that can be used to build these
values. If the value length is larger than the system-determined or specified maximum,
it gets truncated. Note that in prior releases of the Teradata Database 14.0, the
maximum value length could not exceed 16 bytes. Increase the maximum value length
for columns that require more detailed information in the histogram to improve
single-table predicate selectivity estimations. However, this should be done selectively
as needed as it increases the size of the histogram which can increase the query
optimization time.
Max Intervals Maximum number of intervals of a histogram can be customized using the Max
Interval option. If this option is not specified, the system uses a default maximum
number of intervals which is defined as 250. A greater number of intervals increases
the granularity of the data in the histogram and helps to get better single-table and join
selectivity estimations for non-uniform data. However, this should be done selectively
as needed (for columns involved in a predicate exhibiting over or under estimations) as
it increases the size of the histogram which can increase the query optimization time.
Sampling Allows users to customize sample percentage for different collection objects. This
makes system to scan a user-specified percentage of table rows. "n" denotes the sample
size of type integer or decimal which can range from 2 to 100. A sample size of 100 is
equivalent to collecting full statistics.
Threshold Allows users to skip statistics recollection based on amount of data change and/or on
the age of the statistics (if it is below the threshold in effect). The statistics recollection
is done if the age of the statistics is greater than or equal to the number of days
specified or/and if the percentage of change in the statistics exceeds the specified
threshold percentage.

These options are available for adding and removing collection objects:
Option Description
Remove By default all collection objects are marked for statistics collection. User can select
any of the collection objects and click on remove to deselect collection objects.
Add After any statistics objects are cleared from the collection, you can add them again by
clicking Add. This action opens a dialog to choose statistics objects that could be
added to the collection objects again.
Multi-Column Changes the column ordering for the multi-column statistics objects. You can select
Ordering any of the multi-column collection objects and click Multi-Column Ordering. This
opens a Modify Column Ordering dialog where you can use the Up and Down
buttons to change the ordering.

These options are available for previewing the collect statistics SQLs and running them:

104 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Teradata Database

Option Description
Next Previews the SQL that is generated automatically for collecting statistics on the
collection objects.
Finish Runs the SQL that are generated automatically for collecting statistics on the
collection objects.

Collecting Statistics
Collecting statistics on columns and indexes provides the Optimizer with data demographic information it
uses to generate efficient query plans that execute as quickly as possible.
1. Display the Query Development perspective.
2. In the Data Source Explorer, select the table columns and indexes for which you wish to collect
statistics.
You can select more than one column and index in more than one table by holding the Ctrl or Shift key
while you click.
3. Right-click a selected column or index, and click Teradata > Statistics > Collect.
The Statistics Collection view opens, listing the columns and indexes you selected.
4. [Optional] Select one or more of the items in the Statistics Collection Objects list and click Remove to
prevent statistics from being collected on those objects.
The items are removed from the Statistics Collection list.
5. [Optional] To create a multi-column statistic object, select one or more columns in the Statistics
Collection Objectslist and click Add Multi-Column.
A multi-column entry for the selected columns is added to the list.
6. Click Collect.
The Collect Statistics wizard opens.
7. [Optional] Click Options>> to expand the table to display statistic collection options and specify the
options you want for each object.
Tip: Hover your mouse over the Options cells for more information on each option.
8. Do one of the following:
• Click Next to inspect the SQL that will be issued to the connected database to start statistics
collection.
• Click Finish to collect the statistics.

Drop Statistics
The Drop Statistics dialog drops statistics on selected columns and indexes on which statistics are currently
defined. You can select either single or multiple objects to drop the statistics.
The Drop Statistics dialog is opened by selecting tables from the Data Source Explorer and right-click to
select Teradata > Statistics > Drop Statistics.
Use these options to drop statistics:

Teradata Studio User Guide, Release 16.00 105


Chapter 3: Database Administration
Teradata Database

Option Description
Dropping statistics on a table If all columns and indexes of a table from the currently displayed
statistics objects are selected, the drop statistics process
automatically submits Drop statistics on table SQL.

Note:
The table summary statistics are deleted during this operation.

Dropping statistics on individual You can select either single or multiple statistics objects that are
columns or indexes displayed under each table object. Clicking OK starts the drop
statistics process on individual columns and indexes.

Dropping Statistics
Dropping statistics permanently removes statistical data that has already been collected for specified
columns and indexes of a table.
1. Open the Query Development perspective.
2. In the Data Source Explorer, select the tables or columns and indexes for which you wish to drop
statistics.
You can select more than one table or more than one column and index by holding the Ctrl or Shift key
while you click.
3. Right-click a selected object, and click Teradata > Statistics > Drop.
4. If you clicked one or more tables, the Drop Statistics dialog opens to allow you to select the column and
index statistics to drop. After you have selected, click OK.
5. In the Drop Statistics confirmation message dialog, click OK.

Filter Operations
The following filter operators are available options when creating a filter rule. Select the operator and specify
a value. For example, to filter data so that only values greater than 999 are shown, select the ( ) operator
and enter the value 999.

Option Description
None No filter rule. This is the default.
Equal to value

Less than value

Greater than value


Less than or equal to value
Greater than or equal to value
LIKE Similar to the value

106 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database
Collect Statistics SQL Preview
The Collect Statistics wizard automatically generates the collect statistics SQL which can be previewed
using the SQL Preview page.
The options are:
Option Description
Save SQL Saves the SQL to the file you select.
Show In Editor Displays the SQL in the SQL Editor. The Collect Statistics wizard does
not close.

Aster Database

Aster Databases and Privileges


To create an Aster database, you must be a superuser or granted the db_admin privilege.
When you create a database, you are the owner of the database. No other users have the ability to use it
unless you grant them the privilege to use it. As the owner, only you have the ability to drop the database.

Note:
If your database administrator has granted ALL privileges on schema PUBLIC to users in the PUBLIC
role (default), users can by default create databases in any new databases you create, such as tables in the
PUBLIC schema in the new database. Creating one or more schemas in the database and granting or
denying appropriate privileges for users on those schemas can prevent this.

Here are some tips for managing the GRANT/DENY Users privileges for the databases you create.
Grant or Deny Privilege Admin Action
Grant access to the new database Grant at minimum the CONNECT privilege on the
database to users or roles.
Grant ability to create schemas in the new database Grant users at minimum the CREATE privilege on
the database.
Grant ability to create tables in the new database Grant users at minimum the CREATE privilege on
one of the schemas in the database.
Deny users the ability to create tables or objects in a Revoke the CREATE privilege on a database or
database schema for the user.

Granted Privileges
Restrictions on users to read and write to Aster databases are managed as follows:
• GRANT and REVOKE privileges that you set for a database object.
• GRANT privileges on database objects to one or more roles or individual users.
You can grant membership in a role to another role or user, and thus grant the rights and privileges assigned
to a role to its member roles and users.

Teradata Studio User Guide, Release 16.00 107


Chapter 3: Database Administration
Aster Database
Also, granted membership is a way to group users together who require access privileges to specific database
objects. You can manage secure levels of access by granting specific privileges for the group as a whole. We
recommend you create the group role first, and then add users to the role.

Grantee Type and Privileges


When you assign privileges for a database, schema, table, function, or view, you must select a grantee type.
There are three types: User, Role, and Public.
User
Users are Aster database users. Databases on an Aster Database server share the users and groups of
users on the server. You can group users using roles and set group privileges to auto inherit. You can
also set up specific users to have roles which grant them access to specific database objects. To grant a
user the right to create databases, users, and roles, grant the db_admin role. Grant a lower-privileged
role such as catalog_admin to deny the right to create databases, users, and roles.
Role
A role is a database role that an administrator creates or assigns. A role can own a database or have
specific privileges to access objects in the database. You can assign roles to users or groups of users.
Assigning roles to groups of users enables you to manage user groups as roles. Roles can also have log-on
and system access capability, and like groups, include other roles as members. Roles that you create are
valid for all databases on an Aster Database server. A role with INHERIT automatically uses database
privileges granted to all roles that it is a member of.
Public
PUBLIC specifies that privileges are to be granted to all roles. Any single role has the sum of privileges
granted directly to it, plus privileges to any role of which it is presently a member, and privileges granted
to PUBLIC. Grant options cannot be granted to PUBLIC. If your database administrator grants ALL
privileges on schema PUBLIC to users in the PUBLIC role (default install setting), then all users can by
default create databases in new databases, and tables within the PUBLIC schema in the new database.

Aster Databases, Users, and Roles


You must have sufficient privileges granted to you before you can create an Aster database, user, or role. The
default db_admin role is the superuser role of an Aster Database and gives you access to all database objects
without restrictions. Typically, this role is given to your Aster database administrator who then creates and
assigns roles to users enabling them access to specific objects in the database.
When Aster Database installs, the system creates a default database called "beehive". With the appropriate
privileges, you can connect to "beehive" to create new databases, users, and roles. Any users and roles that
you create for an Aster Database are available for all databases located on the same Aster Database server.
The Teradata Studio and Teradata Plug-in for Eclipse development environments provide special dialogs
and forms to assist you in the creation of databases, users, and roles for your Aster Database.

Aster Database Roles and Membership


Aster Database manages database access using roles. An Aster Database administrator creates roles and
assigns them to either a database user or to a group of database users. Depending on how you set up roles,
roles can own database objects and assign privileges to other roles. The assignment of roles controls which
users have access to which objects.

108 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database
An administrator can grant membership in a role to another role. Membership enables a role to use the
privileges granted to the role in which it is a member. Administrators also can use roles to create groups of
users. Groups of users are identified by the roles assigned to them and any rights they have, inherited or not,
to access specific database objects.

Browsing Aster Schemas and Objects


An Aster database contains one or more named schemas. Schema objects in turn contain one or more other
database objects such as tables, indexes, views, and Map-Reduce functions.
When you connect to an Aster Database, the structure of the database displays in the Navigator. The Object
List Viewer displays a detailed list of the objects in the schema and gives you the capability to set the
properties for any object you select.

Defining Databases on an Aster Server

Creating an Aster Database


You must be connected to the Aster Database server before you can create an Aster database. A default
database called beehive is created when Aster Database is initialized. To create your first user-defined
database, you can connect to the beehive database. If at any time you need to undo your database
definition, click Reset to delete your entries and begin again.
1. In the Administration perspective, click an Aster connection.
2. In the Navigator, double click on the Databases category to display the list of databases in the Object
List Viewer.
3. In the Object List Viewer toolbar, click (Create a new Aster database).
4. In the Create Database form, click General and type a Name for the new database.
5. [Optional] In Encoding, select the character set encoding to use for the new database.
6. Click SQL.
a) Review the generated statements that will create the new database.
b) [Optional] Modify the CREATE statement by returning to previous steps to change your selections.
7. Click Commit to create the database.
8. [Optional] Click Privileges and define the privileges:
Grantee Type Description
Users Select a user to whom you want to grant rights for this database,
then select the rights.
Roles Select a role to which you want to grant rights for this database,
then select the rights.
Public Gives the public role to this database.
9. Click SQL to review the generated SQL with added GRANT and REVOKE statements.
10. Click Commit to set the privileges you selected for this database.

Teradata Studio User Guide, Release 16.00 109


Chapter 3: Database Administration
Aster Database
Note:
You can change any privilege you've set by returning to the Privileges tab and double-clicking a
privilege icon.

Naming an Aster Database


Names in Aster Database are case-sensitive; therefore, MyDatabase and mydatabase are different databases.
Additionally, database names must adhere to these rules:
• Contain only alphanumeric characters and the underscore (_) character.
• Be a maximum length of 50 characters.
• Be allowed by PostgreSQL and cannot be a PostgreSQL keyword.
• Cannot contain the prefix '_bee' which is reserved for Aster Database system object names.

Database Form
Use the Database form to specify a database object definition that can be used to create a new Aster database
or modify the privileges of an existing one.

Database Properties
Click the property option tabs in the left panel to view database properties, such as name, assigned
privileges, or generated DDL in the right panel.
• General — Specify the name of a new database. You can also specify the encoding standard to use.
• Privileges — Specify grant and revoke rights for this database. You must first create the database
before you can assign privileges for it.
• SQL — Review the generated CREATE DATABASE statement that is based on the selections you
made.

You must click Commit to create the database before you can assign privileges in the Privileges tab.

Dropping an Aster Database


Only the owner of a database can drop the database. Dropping an Aster database removes all objects
contained within the database. The destruction of a database cannot be undone.
1. In the Object List Viewer, select the database you want to drop.
You can select multiple databases at one time.

110 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database

2. Right-click the database and click Drop, or click .


3. Click OK to confirm.

Defining Aster Schemas

Creating an Aster Schema


You must define at least one schema in an Aster database before you can create tables, views, or other objects
or move data.
1. In the Administration perspective, click an Aster connection.
2. In the Navigator, double-click on the database in which you want to create the schema.
The list opens in the Object List Viewer.
3. In the Object List Viewer, display the schema list and click .
4. In the Create Schema form, click General and type a Name for the new schema.
5. Click SQL.
a) Review the generated SQL statements that will create the new schema.
b) [Optional] Modify the CREATE statement by returning to previous steps to change your selections.
6. Click Commit to create the schema.
7. [Optional] Click Privileges and define the privileges:
Grantee Type Description
Users Select a user to whom you want to grant rights for this schema, then
select the rights.
Roles Select a role to which you want to grant rights for this schema, then
select the rights.
Public Gives the public role to this schema.
8. Click SQL to review the generated SQL with added GRANT and REVOKE statements.
9. Click Commit to set the privileges you selected for this schema.

Note:
You can change any privilege you've set by returning to the Privileges tab and double-clicking a
privilege icon.

Schema Form
Use the Schema object form to create a new schema in an Aster Database.

Teradata Studio User Guide, Release 16.00 111


Chapter 3: Database Administration
Aster Database

Schema Properties
Click the property option tabs in the left panel to view schema properties, such as schema name,
assigned privileges, and generated SQL, in the right panel.
• General — Specify the name of a new schema.
• Privileges — Specify GRANT and REVOKE rights for the schema. You must create the schema
object before you can assign privileges.
• SQL — Review the CREATE SCHEMA statement that was generated based on the selections you
made.

You must execute the generated SQL by clicking Commit to create the schema object before you can assign
privileges.

Dropping an Aster Schema


To drop a schema, you must be the owner of the schema object. The owner can drop a schema and all
objects it contains even though the owner does not own some objects in the schema.
1. In the Object List Viewer, select the schema you want to drop.
2. Right-click the schema and click Drop, or click .
3. Click OK to confirm.

Defining Aster Database Users

Creating an Aster Database User

1. In the Administration perspective, click an Aster connection and choose the Users category.
2. In the Object List Viewer toolbar, click .
3. In the Create User form, click General and type a Name for the new user.
4. Assign and confirm a password.
5. [Optional] Select Inherit so this user automatically inherits group privileges.

112 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database
6. Click SQL.
a) Review the generated statements that will create the new user.
b) [Optional] Modify the CREATE statement by returning to previous steps to change your selections.
7. Click Commit to create the user.
8. [Optional] Click In Roles and specify roles for this user.

Role Name Description


In Role User is member of the role.
Not in Role User is not a member of the role.
Add to Role User selected to be added as a member of the role.
Remove from Role User selected to be removed as a member of the role.
9. [Optional] Click Object Privileges and define the privileges:
a) Select the Object Type.
b) Select the Database that contains the objects on which you want to set privileges for the user or
select ALL.
c) Set the privilege for each object you select in the Object Name column.
10. Click SQL to review the generated SQL.
11. Click Commit.

User Form
Use the User object form to specify a user definition that can be used to create a new Aster database user or
modify the roles and privileges of an existing one.

User Properties
Click the property option tabs in the left panel to view related user properties, such as user name and
password, assigned roles, and generated DDL, in the right panel.
• General — Specify the name of a new user. You must specify a user password.
• In Roles — Specify which roles to grant to this user. You must first create the user object before you
can assign roles for it.

Teradata Studio User Guide, Release 16.00 113


Chapter 3: Database Administration
Aster Database

• Object Privileges — Specify the level of privileges granted to this user for specific objects in the Aster
Database. You must first create the user object before you can assign privileges for it.
• SQL — Review the CREATE USER statement that was generated based on the selections you make.

You must execute the generated SQL by clicking Commit to create the user object before you can assign
roles or privileges.

Dropping an Aster Database User


Dropping a user removes the specified user from the Aster Database. To drop a user, you must be a
superuser.
1. In the Object List Viewer, select the user you want to drop.
2. Right-click the user and click Drop, or click .
3. Click OK to confirm.

Defining Aster Roles

Creating an Aster Role


After you create an Aster Database role, you can use that role across all databases residing on the same Aster
Database server.
1. In the Administration perspective, click an Aster connection.
2. In the Navigator, double-click on the database in which you want to create the roles.
the list of databases in the Object List Viewer
3. In the Object List Viewer, display the roles list and click .
4. In the Create Role form, click General and type a Name for the new role.
5. [Optional] Select the Inherit check box to specify this role inherits the privileges of roles of which it is a
member.
6. Click SQL.
a) Review the generated statements that will create the new role.
b) [Optional] Modify the CREATE statement by returning to previous steps to change your selections.
7. Click Commit to create the role.
8. [Optional] Click In Roles and specify to which roles the new role.
9. [Optional] Click Members of Role and select the Member Type.
10. [Optional] Click Object Privileges and define the privileges.
11. [Optional] Click SQL to review the generated SQL with added GRANT and REVOKE statements.
12. Click Commit to set the privileges you selected for this role.

Note:
You can change any privilege you've set by returning to the Privileges tab and double-clicking a
privilege icon.

114 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database
Role Form
Use the Role form to specify a role definition that can be used to create a new Aster role or modify the roles
and privileges of an existing one.

Role Properties
Click the property option tabs in the left panel to view role properties, such as in role and membership
rights, in the right panel.
• General — Specify the name of a new role.
• In Roles — Specify which roles this role is a member of. You must create the role object before you
can define roles.
• Members Of Role — First select the Member Type (Users or Roles) and next add the users or roles
to be a member of this role by selecting the MEMBER or w/Admin check boxes. You must create the
role object before you can administer privileges for the role.
• Object Privileges — First select the object to which you want to grant rights by this role and next
specify the privileges to grant to this role by selecting the check boxes beside the object.
• SQL — Review the generated CREATE ROLE statement that is based on the property selections
made.

Be sure to commit your SQL role definition to create a new role or to save your changes to an existing role in
the Aster Database.

Dropping an Aster Role


When you drop a role, you permanently remove the role from the Aster Database. You cannot drop the
db_admin or catalog_admin roles from an Aster Database.
1. In the Object List Viewer, display the Roles tab, and select the role you want to drop.
You can select multiple roles at one time.
2. Right-click the role and click Drop, or click .
3. Click OK to confirm.

Teradata Studio User Guide, Release 16.00 115


Chapter 3: Database Administration
Aster Database

Defining Aster Tables


When creating tables in Aster Database, follow these guidelines:
• Each table must be either a fact table or a dimension table.
• Because Aster Database physically distributes most tables, the rows of each distributed table are stored
throughout the cluster. The Distribute By field in the Storage tab of the Table object form enables you
to control distribution of data by specifying a distribution key.
• Optionally you can partition data in a large table into child partitions. Partitioning can enable faster
query responses. The Partition by field in the Storage tab of the Table form enables you to control how
data is partitioned.
For more information about table types in Aster Database, see the Aster Database User Guide.

Aster Analytic Tables and Persistence


Analytic tables hold data across the span of several transactions, sessions, or days. You can use analytic tables
only for derived data and never for original source data. If data needs to persist longer than a few days,
consider using a Regular table. Analytic tables are not replicated, and do not survive a system restart.

Note:
Regular (persistent) tables are only available for regular Aster database connections, not Aster Execution
Engine (Aster-on-Hadoop) connections.

• Analytic tables are not replicated, and do not survive a system restart.
• Analytic tables may be FACT or DIMENSION tables (non-replicated).
• Analytic tables do not support columnar storage.
• You can perform a logical backup and restore for analytic tables. Physical backup and restore are not
supported.
• You can create analytic tables as logically partitioned tables. This results in the entire table hierarchy
being analytic.
• Do not create analytic tables as parent/child tables with inheritance.

Creating an Aster Table


At minimum, an Aster table must have a table name, table type, and one column defined. Fact tables also
require that you identify a column for distributing data. If you need to undo a table definition at any time,
click Reset to delete your entries and begin again.

Note:
Several of the options available for tables created in a regular Aster database connection are not available
for tables created in an Aster Execution Engine (Aster-on-Hadoop) instance connections. Where there
are differences, they are noted in the steps below.

1. In the Administration perspective, click an Aster connection.


2. In the Navigator, double-click on the Databases category.
The database list opens in the Object List Viewer.
3. Locate the database and schema where you want to create a table.
4. In the Object List Viewer, click .
The Create Table form displays.

116 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database
5. In the General tab, type a Name for the new table.
6. [Optional] For a regular Aster database connection select the Persistence level.in

Option Description
Regular Regular or Persistent tables are persistent across sessions and transactions and
(persistent) continue to exist along with its data until the table is dropped. This type of table
survives system restarts, node changes, partition splitting, exports and loads,
backups, restores, and other types of operations. If data needs to persist longer than a
few days, consider using a Regular table.

Note:
This is the default for a regular Aster database connection, but is not available for
an Aster Execution Engine instance (Aster-on-Hadoop) table.

Analytic Analytic tables hold data across the span of several transactions, sessions, or days.
Use Analytic tables only for derived data and never for original source data. Analytic
tables are not replicated, and do not survive a system restart.
7. [Optional] Select the Table Type:

Option Description
Fact A single, large table that records raw data as facts, such as measurements or metrics for a
specific event. Fact tables typically contain numeric values and foreign keys to
dimensional data stored in other tables. A fact table is always a distributed table. This is
the default.
Dimension A set of tables that contain values and descriptive attributes for data recorded in a fact
table. Dimension tables can be replicated or distributed.

Note:
If you selected Fact, you must open the Storage tab and in the Distribute by field, select the column
you want to be the key distribution column from the list.
8. Click Columns and for each column you add to the table, complete the following information:
a) Type the name of the new column in Column Name.
b) Select the Data Type.
c) In Length, type the maximum data length allowed for column data if appropriate for the selected
type.
d) Type the maximum Precision allowed for numeric column data.
The precision of a numeric is the total count of digits in the whole number (both sides of a
decimal). For example, the number 3068.443 has a precision of 7. The precision must be a positive
number.
e) Type the maximum Scale allowed for numeric column data.
The scale of a numeric is the count of decimal digits in the fractional part of the number to the right
of the decimal point. For example, the number 3068.443 has a scale of 3. The scale of an integer is
considered zero, therefore, scale can be zero or a positive number.
f) Select Null if data values in this column can be null.
g) Select Unique if data values in this column must be unique.
h) [Optional] Type a Default value if appropriate for the column type.

Teradata Studio User Guide, Release 16.00 117


Chapter 3: Database Administration
Aster Database
By defining a default value, you ensure that the column is set to the default value if no value is
provided when a row is inserted or updated. When you add a column, if a default value is specified,
all existing rows in the table are initialized with the column default value. If no default value is
defined, existing rows are initialized with NULL.
9. [Optional] Click Indexes and for each index you Add, complete the following information:
a) Type the name of the index to be created in Index Name.
b) Select a Compression option.
c) Click Add beside the Index Members table.
d) In Column Name/Expression select a column to become a member of this index or an expression
computed from the values of one or more columns of the table row.
The column you added as an index member displays in the Member Summary.
e) [Optional] Select the Ascending check box to specify the ordering of values in the column as ASC
(ascending).
f) [Optional] Select the Nulls First check box to specify that null values sort before non-null values. If
not selected, null values sort after all non-null values.

Note:
The Ascending and Nulls First selections determine the sorting order of the result rows in the
result column.
g) In WHERE insert the WHERE constraint expression for a partial index.
If the WHERE clause is present, a partial index is created that contains only that portion of the table
which is most useful for indexing.
10. [Optional] Click Constraints and for each constraint you Add, complete the following information:
a) Type a name for the constraint in the Constraint Name.
b) Select a Constraint Type.
UNIQUE and PRIMARY KEY constraint specifications consist of one or more column names.
CHECK constraints require that you specify the conditions of the check.
c) If you selected UNIQUE or PRIMARY KEY type, click Add beside the Index Members table,
thenselect one or more column names in the Columns section.
d) If you selected CHECK type, specify the check constraint condition in the Check Constraint
Condition section.
e) Review the Constraint Summary to ensure the constraint values you set are correct.
11. Click Storage.
a) In Distributed by, indicate how you want the data distributed for this table; default is
REPLICATION.
If you selected Fact as the Table Type in the General tab, you must select the column you want to
be the key distribution column . The options listed include the names of all columns identified in
the Column tab.
b) Select Storage by Row if you want the table data stored by the table row. For an Aster Execution
Engine (Aster-on-Hadoop) table, storage must be by row; there is no column storage.
If you do not select the check box, data storage is by column. However, for an Aster Execution
Engine (Aster-on-Hadoop) table, storage must be by row so this option is selected and cannot be
changed.
c) [Optional] In Compress, select the level of compression for an existing partition. This option is not
available for an Aster Execution Engine (Aster-on-Hadoop) table.
d) [Optional] In Inherits, accept the default value or type a different value.
Inherits indicates whether the table has an inheritance relationship with a parent table.

118 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database
e) [Optional] In Partition By, use the PARTITION BY RANGE or PARTITION BY LIST clause to
define child partitions and to specify which partition each row belongs to.
The PARTITION BY clause creates the table as logically partitioned in separate files, and defines
the layout of the partition.
12. Review the generated SQL and click Commit to create the table in the schema.
You must create the table before you can assign table privileges.
13. [Optional] Click Privileges and define the privileges:
Grantee Type Description
Users Select a user to whom you want to grant rights for this table, then
select the rights.
Roles Select a role to which you want to grant rights for this table, then
select the rights.
Public Gives the public role to this table.
14. Click SQL and review the generated statement.
To modify the CREATE TABLE statement, return to previous steps to change your selections. You can
also copy and paste the text into an SQL Editor to make edits.
15. Click Commit to execute the statement and update the table definition on the Aster Database server.

Table Form
Use the Table object form to specify a table definition that creates a new Aster schema table or modifies
privileges for an existing one.

Table Properties
Click the property option tabs in the left panel to view table properties, such as table and column names,
storage properties, privileges, and generated DDL, in the right panel.
• General — Specify the name of the new table.
• Columns — Specify at minimum one column in the new table.

Teradata Studio User Guide, Release 16.00 119


Chapter 3: Database Administration
Aster Database

• Indexes — Specify the indexes for a new table.


• Constraints — Specify constraints for the table.
• Storage — Specify how you want data distributed in the table. If this is a Fact table, you must select a
column to use as the key distribution column in the Distributed by field.
• Privileges — Specify the privileges granted to this table for specific users and roles in the Aster
Database. You can also specify PUBLIC privileges for the table object.
• SQL — Review the CREATE TABLE statement generated based on your selections and field entries.
The generated DDL statement creates the table or modifies selected table privileges.

You must execute the generated SQL by clicking Commit and create the table before you can assign
privileges.

Dropping an Aster Table


To drop a table, you must be the owner of the table. Dropping a table removes the table from the database,
including all table rows, and any indexes and constraints that exist for the table.
1. In the Object List Viewer, select the table you want to drop.
You can select multiple tables at one time.
2. Right-click the table and click Drop, or click .
3. Click OK to confirm.

Aster Table Types


Aster Database uses a dimensional model known as a star schema to provide high performance for large,
data analytics workloads. The star schema consists of fact and dimension tables.
When you define an Aster table, you must specify whether it is a FACT or DIMENSION table. Your decision
affects how Aster Database stores the table data and optimizes it for the types of operations that use the
table, such as joins between tables.

Fact Table
A fact table is a single, large table that records business process data as facts, such as measurements or
metrics for a specific event. Fact tables typically contain numeric values and foreign keys to the
dimensional data stored in other tables.
Fact tables contain two types of columns: fact columns and foreign key columns. In Aster Database, you
must declare a distribution key column for each fact table using the Distribute by (DISTRIBUTED BY
HASH) field in the Storage tab of the Table object form in Object List Viewer. The selection you make
tells Aster Database how to physically distribute the table data across v-workers. A fact table is always a
distributed table.
Dimension Table
A dimension table is a set of tables that contain the domains of values that describe attributes for the
events and factual data recorded in a fact table. Each dimension table contains a set of values for a
specific dimension. For example, a customer contact table would contain detailed information about
each customer such as customer _id, name, phone, address, and other information. A dimension table
can be a distributed table or a replicated table.

120 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
Aster Database

Most dimension tables are replicated in Aster Database with a copy on every node in the cluster.
Optionally, you can specify your dimension table as distributed by (DISTRIBUTE BY HASH) by
declaring a distribution key column in the Distribute by field in the Storage tab of the Table object
form in Object List Viewer. This option distributes the table across nodes using the distribution key
you specify, instead of replicating the table on every node. In Aster Database a replicated table is by
definition a dimension table.

Defining Aster Views

Creating an Aster View

1. In the Administration perspective, click an Aster connection.


2. In the Navigator, double-click on the Databases category.
The database list opens in the Object List Viewer.
3. Locate the database and schema where you want to create a view.
4. In the Object List Viewer, click .
5. In the Create View form, click General and type a Name for the new view.
6. Click the View Query tab.
7. Specify one or more source tables in the SELECT * FROM clause.
8. Click SQL.
a) Review the generated statements that will create the new view.
b) [Optional] Modify the CREATE statement by returning to previous steps to change your selections.
9. Click Commit to create the view.
10. [Optional] Click Privileges and define the privileges:
Grantee Type Description
Users Select a user to whom you want to grant rights for this view, then
select the rights.
Roles Select a role to which you want to grant rights for this view, then
select the rights.
Public Gives the public role to this view.
11. Click SQL to review the generated SQL with added GRANT and REVOKE statements.
12. Click Commit to set the privileges you selected for this database.

Note:
You can change any privilege you've set by returning to the Privileges tab and double-clicking a
privilege icon.

View Form
Use the View object form to specify a view definition that can be used to create a new view object or modify
the privileges of an existing one.

Teradata Studio User Guide, Release 16.00 121


Chapter 3: Database Administration
DDL Management

View Properties
Click the property option tabs in the left panel to display the view properties, such as view name and
generated DDL statement, in the right panel.
• General — Specify the name of a new view.
• View Query — Specify the SELECT statement for the view.
• Privileges — Specify the level of privileges granted for this view. You must create the view object
before you can assign privileges.
• SQL — Review the CREATE VIEW statement that was generated based on the selections you made.

You must execute the generated SQL by clicking Commit to create the view object before you can assign
privileges.

Dropping an Aster View


Dropping a view removes the existing view. To drop a view, you must be the owner of the view.
1. In the Object List Viewer, select the view you want to drop.
You can select multiple views at one time.
2. Right-click the view and click Drop, or click .
3. Click OK to confirm.

DDL Management

Showing DDL Statements


1. Connect to a Teradata or Teradata Aster database.
The Teradata Aster database must be version 6.10 or later.
2. Open the Data Source Explorer and navigate to a database object.

122 Teradata Studio User Guide, Release 16.00


Chapter 3: Database Administration
DDL Management
3. Right-click the object name and do one of the following:
• For Teradata objects, select Teradata > Show DDL
• For Aster objects, select Aster > Display DDL.
If you are not in the Query Development perspective, which has an SQL Editor view by default, a
message appears asking if you want to switch to it. If you Click No, an SQL Editor view opens in the
current perspective to show the DDL.
The CREATE statement that defines the object displays in the SQL Editor.

Data Definitions Generation

Generate DDL Basics


You can easily generate SQL CREATE, DROP, and COMMENT statements for existing databases and
database objects using the Generate DDL wizard. Access the wizard from the Data Source Explorer right-
click menu. The wizard generates the SQL, and allows you to save the code as a text-format SQL script file
(.sql extension, by default) in the Eclipse project. Optionally, the wizard can open the script directly in the
SQL Editor, where you can edit the script and execute the generated DDL on a specified connection profile.
Use the Generate DDL wizard to copy partial or entire database schemas between different servers on
different connection profiles. Copy database objects between different databases or users. You can use the
wizard to generate and execute DROP statements for several objects or object categories to save time when
you need to drop several objects. You can use the generated DDL as a backup of the current database
structures in case you need to revert to a prior state. You can also modify the generated DDL by opening
the .sql file in the SQL Editor.

Generating DDL for Database Objects


The Generate DDL wizard generates the SQL CREATE and DROP statements for databases and database
objects. You can save the SQL to a script file, and execute the DDL script from the SQL Editor.
For Aster systems, this only applies to Aster 6.10 and later.
1. In the Data Source Explorer, click to select one or more of the same type of database object. .
2. Right-click one of the selected objects and click database_type > Generate DDL, where database_type
is the type of database for the current connection profile, for example, Teradata or Aster.
The Objects dialog of the Generate DDL wizard opens.
3. Select the types of DDL statements you want to generate for the selected objects, and click Next.
4. Select the classes of objects for which the DDL will be generated, and click Next.
The object definitions you are able to generate depend on the type of object you selected in Data
Source Explorer.
The wizard generates the DDL and displays the resulting script in the Save DDL page.
5. Use the Folder and File Name fields to specify where you want the wizard to save the generated script.
The default is the SQL folder displayed in the Project Explorer. Click Browse to specify a different
folder.
6. Review the generated DDL script in the Preview DDL area.
7. [Optional] Select the Open DDL file for Editing check box to open this SQL file in an SQL Editor
when you click Finish.

Teradata Studio User Guide, Release 16.00 123


Chapter 3: Database Administration
DDL Management
8. Click Next.
9. Review the Summary of selections you made in previous steps.
To make changes, click Back to return to a previous panel of the wizard and make your change.
10. Click Finish.
The script file is saved to the location and file name you specified, and appears in the Project Explorer
view. If you chose to open the DDL file for editing, the generated DDL displays in the SQL Editor
where you can edit it and save or execute the edited DDL.

124 Teradata Studio User Guide, Release 16.00


CHAPTER 4
Teradata Data Lab

About Data Lab


A data lab is a separate dedicated work space, also known as a "sandbox", within the data warehouse where
you can explore, analyze new data, and test data value theories. Developers of new analytic queries can
combine their personal, ad hoc, or temporary data with production data for agile development.

About the Data Lab View


The Data Lab View provides access to your tables from a Teradata Data Lab. It is a tree view that displays
the hierarchy of Data Lab groups with child Data Labs. In the hierarchy, a Data Lab has tables as children.
From the view you can copy, load, and export data into Data Labs. The Data Lab View also allows you to
create tables derived from external file data using the Smart Load Wizard.

Teradata Studio User Guide, Release 16.00 125


Chapter 4: Teradata Data Lab
About the Data Lab View
Teradata Connection Profile
Provides access to a list of Connection Profiles. You must connect to the profile before you can select it
in the list. The Teradata Database version displays beside the selected profile name.
Data Lab Groups
Lab groups allocate space for data labs and can be organized to fit your objectives for the labs, such as by
individual, function, department, or region. Groups display as a hierarchy with child data labs in
expandable views below parent groups.
Tables Accessible from Data Lab
Tables display as child data labs of a data lab group.

Opening the Data Lab View


1. From the Data Transfer perspective, click the Data Lab icon on the toolbar to open the Data Lab View.

Copying Tables to Data Labs


The Data Lab View enables you to access tables as child data labs in a data lab group. Copying a Teradata
table to a data lab is as easy as dragging the source table from the Data Source Explorer and dropping it
into the Data Lab View. The Data Lab Copy Wizard guides you through the steps of performing a table
copy.

Note:
The Copy Wizard is not provided in Teradata Studio Express.

1. Open the Data Source Explorer and navigate to the table object to copy to the Data Lab View.
2. Drag the table object to the Data Lab View and drop it on the parent data lab group.
3. In Copy Table verify the Source and Destination information is correct.
4. If the table does not exist in the data lab group, select from these options:

Option Description
Copy Data Copies the source table data to the data lab table. To create a new table that is empty, de-
select this option. If the target table exists, select to append or replace the data in the
Data Lab.
Lock Table Locks the table during the copy operation. Locking tables might cause performance to be
slow.
5. If the table already exists in the data lab group, select from these options:

Option Description
Lock Table Locks the table during the copy operation.
Append to Existing Data Appends the source table data to the end of the data in the destination
table.
Replace Existing Data Replaces all existing data in the data lab table with the source table data.
6. Click Next.

126 Teradata Studio User Guide, Release 16.00


Chapter 4: Teradata Data Lab
Data Lab Copy Wizard
7. In Filter Table specify which table columns to copy and then select a filter type and data value to filter
the data in the column.
This filter creates the SELECT statement for the COPY operation.
8. Click Next.
9. In SQL Preview Filter Table, review the generated SQL for the COPY operation.
10. Click Finish.
11. Monitor the progress of the COPY operation in the Transfer Progress View.

Data Lab Copy Wizard

About the Data Lab Copy Wizard


The Data Lab View supports drag and drop of table objects from Data Source Explorer. When you drop a
table into the Data Lab View, the Data Lab Copy Wizard opens.

Note:
The Copy Wizard is not provided in Teradata Studio Express.

Using the wizard you can specify data filters to determine which columns and data to copy to the Data Lab.
You can also lock the table while you are transferring data using the Lock Table option.
The Copy Wizard displays the following dialogs:
Dialog Name Description
Copy Table Displays the database and table name of the data source and destination.
Use this screen to verify that the copy information is correct.
If you are copying to a new table, you can select the Copy Data option to
copy the data when the new destination table is created. Clear this option
to create an empty table.
If you are copying to an existing table in the Data Lab, you must specify
whether you want the data appended to the existing data or to replace all
existing data with the source table data.
Filter Table Enables you to select which columns in the source table to copy to the
Data Lab table. After you select a column, you can refine the copy
operation by specifying which data in that column to copy. The default is
to transfer all data.
SQL Preview Filter Table Displays the generated Data Definition Language (DDL) script that
copies the source table to Data Lab. The copy job can be run by clicking
Finish.

About Copy Table


When you drag and drop a table from the Data Source Explorer to the Data Lab View, the Copy Wizard
displays the name of the source and destination tables in the Copy Table dialog.

Teradata Studio User Guide, Release 16.00 127


Chapter 4: Teradata Data Lab
Data Lab Copy Wizard

Source Database
The source information includes the names of the Connection Profile, Database, and Table from
which the data is copied.
Destination Database
The destination information includes the names of the Connection Profile, Database, and Table to
which the Copy Wizard copies the data.
Instructions for Copy Job
You can specify these options for the Copy job:
Option Description
Copy Data Creates the destination table and copies the source data to the new
table. If you want to create an empty table, do not select this option.
Lock Table Locks source and destination tables during the data transfer.

About Filter Table


The Copy Wizard enables you to review the source table columns and specify which columns and data you
want copied to the Data Lab destination table.

128 Teradata Studio User Guide, Release 16.00


Chapter 4: Teradata Data Lab
Data Lab Copy Wizard

Column Filter
Lists filter types available. You must enter a value that is valid for the column data type. The data type
displays beside the column name.
Column Select for Copy
Allows you to select a check box beside a column name to copy the column to the destination table. All
columns are selected by default.
Actions on All Columns
Allows you to perform actions on all columns at the same time. All columns are selected by default. Use
the Clear All and Select All buttons to act on all columns in the table.

About SQL Preview Filter Table


The generated Data Definition Language (DDL) script that copies the source object to its destination
displays in the Generated SQL text area.

Teradata Studio User Guide, Release 16.00 129


Chapter 4: Teradata Data Lab
Data Lab Copy Wizard

Generated DDL Script


DDL Script generated from the information you provided in previous screens of the Copy Object
Wizard. Run this script to perform the copy operation.

130 Teradata Studio User Guide, Release 16.00


CHAPTER 5
Query Development

Data Tools for Query Development


Teradata provides multiple tools to assist you in developing queries for the Teradata databases in your
system.

Data Tools Description


Teradata SQL Editor Extends the Eclipse Data Tools Platform (DTP) SQL Editor to
provide SQL development on Teradata databases.
SQL Query Builder Extends the Eclipse Data Tools Platform (DTP) SQL Query Builder
to provide execution on Teradata databases.
Compare Editor Compares the Data Definition Language (DDL) text of two
database objects.
Compare SQL Object Wizard Enables you to compare the Data Definition Language (DDL) text
in a database object with another object of the same type in either a
Teradata Database or Aster Database.
Result Set Viewer Provides an enhanced view of a result set that includes options to
hide columns, filter on column values, find column values, copy
data to the clipboard, format cell data, and switch between grid and
text view.
SQL History View Provides historical information about SQL/DDL executions on one
or more databases in your system.
Statistics Collection View Collects the statistics on table columns and indexes that are
important to producing query plans.

Teradata SQL Editor

About the SQL Editor


The SQL Editor provides an integrated environment for the development of SQL files that enable you to
develop SQL statements for execution. The editor enables you to validate SQL syntax, save files to a project
or export to system files, and execute all SQL in a file or execute the SQL as individual statements. You must
specify a Connection Profile before you can execute an SQL query statement.
The SQL Editor displays when you open an SQL/DDL file or when you select the Query Development
Perspective. Double-clicking an SQL/DDL file in the Project Explorer opens that file in the editor. You can

also open the SQL Editor by clicking in the Query Development perspective.

Teradata Studio User Guide, Release 16.00 131


Chapter 5: Query Development
Teradata SQL Editor

Connection Profile Name


Selects the profile in which to run the SQL script. You do not have to connect to a Connection Profile to
display the Connection Profile name in the list.
Editor Work Area
Displays the active SQL edit window. You can insert, delete, and modify SQL statements displayed in
this area.
Connection Status Indicator
Shows the status of the connection to the selected Connection Profile. Green indicates that the
connection is active.
Autocommit Toggle
When selected, submits each SQL statement in autocommit mode. Each SQL statement is then executed
in its own transaction that ends with a COMMIT statement. You cannot roll back an SQL statement that
is executed in autocommit mode. When Autocommit is set to ON, the Autocommit check box in the
toolbar is selected. To turn Autocommit OFF, clear the check box.
Max Rows
Changes the maximum number of rows returned by SQL executed in this editor.
SQL Execution Options
Displays a list of Execute options. You can select to Execute an Individual Statement that you have
selected, or to Execute All query statements in the editing pane.
SQL Editor Toolbar
A set of tools to manage and execute SQL.
Content Assist
Provides aids for validating, debugging, and editing the SQL queries you develop in the editor. You can
use the Text Editors preference settings ( Window > Preferences > General > Editors > Text Editors)
to change the appearance of the SQL Editor, including displayed tab widths, color options, line
numbers, mouseovers, and more.

Using the SQL File Editor


The Teradata SQL Editor supports:
• Teradata Database connection profiles
• Aster Database connection profiles
• Hadoop File System connection profiles with JDBC enabled

132 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
If you are working with SQL files located on a different type of database, such as Oracle or MS SQL Server,
you must work in the SQL File Editor.
1. Do one of the following:
• In Project Explorer, right-click the SQL folder.
• Open the SQL Editor and right-click in the main editor pane.
2. Select Open With > Other....
The Editor Selection dialog displays.
3. Select SQL File Editor.
4. Click OK.
5. Under Connection Profile, select the Type of database for this connection; for example, Oracle_10 or
SQL Server_2005.
6. Select the Name of the connection profile from the list.
Only existing connection profiles display in the list.
7. Select the Database name from the list.
Aster and Hadoop have no database name.
8. Verify the status of the profile you selected.
Status information displays to the right of the Database name. If no connection profile exists for a
particular profile type, the Name and Database fields are blank.

Drag and Drop into SQL Editor


You can drag objects from the Data Source Explorer and drop them into the SQL Editor to build your SQL
statement. The object name appears in the SQL Editor at the location where you drop it.

SQL Editor Preferences


The SQL Editor preferences customize the behaviors and look-and-feel of the SQL Editor. To set
preferences for general editor appearance and behaviors, go to Window > Preferences > Data
Management > SQL Development > SQL Editor.

General Tab
You can specify the following general preference settings:

Teradata Studio User Guide, Release 16.00 133


Chapter 5: Query Development
Teradata SQL Editor
Syntax Validation
Validates the syntax of the SQL statement.
Option Description
Enable syntax validation Syntax validation automatically updates the structure of an SQL
statement in the Outline view and performs the syntax validation as
you edit. The SQL Parser parses the SQL statement according to the
grammar for the version of Teradata or Aster specified in the
Connection Profile.

Note:
Disabling validation also disables portability checking and the
Outline view.

Portability check target Selects the Teradata database type to use as the standard target for
portability checks. You must enable syntax validation to select a
portability target. Select None to indicate no database type for
portability checks (default).
Each line that is not portable to the target is annotated with a check.
You can display additional information by placing the cursor over
the marker.
Maximum number of lines Specifies the maximum number of lines of SQL content to validate
before disabling syntax validation. Select a number that optimizes
validation without impacting editor performance. The default is
1000. Clear the check box to indicate no restriction to the number of
lines of SQL to validate.
Prompt to disable system Displays a message asking if you want to disable system validation.
validation when content The message displays if the number of lines in the SQL file exceeds
exceeds maximum number of the value entered in Maximum number of lines.
lines
Show detailed annotation When selected enables the SQL Editor to display the list of possible
information correct syntax options when a syntax error occurs in the SQL
statement.

Execute Current Text


Specifies what delimits the current text when you select Execute Current Text from the SQL Editor
menu.
Option Description
Execute SQLs between Selects the delimiter used in text to separate SQL statements for
delimiters execution.
Execute current line Selects only the currently selected line of SQL code is to be executed.
Execute SQLs between blank Selects to use blank lines as the delimiters for separating SQL
lines statements for execution.

134 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
Typing Tab
Select check boxes to enable or disable typing aids that are available when editing in Smart Insert mode.
Click to select an option and display the SQL in the Preview text area.

Option Description
Close single quotes Inserts characters to close a single quote in the SQL Editor.
Close double quotes Inserts characters to close a double quote in the SQL Editor.
Close parentheses Inserts characters to close a parentheses in the SQL Editor.
Close comments Inserts characters to close multi-line comments in the SQL Editor. For
example, if you type /* to indicate the start of a comment, the editor
inserts */ to close the comment.
Begin-End Adds the End with proper indentation in the SQL Editor, and then
moves the cursor to a new line between Begin/End with proper
indentation.

SQL Formatter Preferences


This preference page is where you can configure the options which control the Teradata formatting strategy
for SQL text using the following options:
Main Option Description
Keyword Case Option Specifies how to format keywords using the following sub-options:
Uppercase Converts all keywords to
uppercase
Lowercase Converts all keywords to
lowercase
Starts with Uppercase Converts only the first letter to
uppercase and the rest of the
keyword is lowercase
Unchanged Keywords are left as they were
Identifier Case Option Specifies how to format identifiers using the following sub-options:
Uppercase Converts all identifiers to
uppercase
Lowercase Converts all identifiers to
lowercase
Starts with Uppercase Converts only the first letter to
uppercase and the rest of the
identifier is lowercase
Unchanged Identifiers are left as they were
Stacking Lists Option Specifies how to arrange lists, such as Select lists, From lists, Order By
lists, Group By lists, Parameter lists, and Column definition lists. If

Teradata Studio User Guide, Release 16.00 135


Chapter 5: Query Development
Teradata SQL Editor

Main Option Description


there is only a single item in the list, the formatter always places it on
the same line as the context keyword, regardless of the option.
Same Line Places list items all on the same
line
Line Break After Comma Places a line break after the
comma
Line Break Before Comma Places a line break before the
comma
Line Break Before Comma with Places a line break before the
Space comma and adds a space after the
comma
Unchanged Lists are left as they were
Indentation Option Specifies whether to use spaces or tabs for indentation.
Space Size Specifies the size of the indentation for spaces. The value must be
between 0 and 9. If tabs were chosen for the indentation option, the
tab size is specified on the General > Editors > Text Editors Preference
page (Displayed tab width).
Where Clause Break Option Specifies whether to place the AND and OR elements of the WHERE
clause on separate lines or the same line.
Line Break and Indent Places the list of AND and OR
elements on new lines at the
indentation level.
Same Line Places the list of AND and OR
elements on the same line.

SQL Editor Toolbar


The SQL Editor toolbar enables Connection Profile selection and action buttons that help you manage and
execute SQL for supported databases.
The SQL Editor Toolbar contains the following:

Connection Profile
Select a Connection Profile from the list. If the selected profile is not connected, confirm you want to
connect by clicking Yes, enter the connection password, and click OK.
Connection Status
Shows the status of the connection to the selected Connection Profile. Green indicates that the
connection is active.
Autocommit Toggle
When selected, submits each SQL statement in autocommit mode. Each SQL statement is then executed
in its own transaction that ends with a COMMIT statement. You cannot roll back an SQL statement that

136 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
is executed in autocommit mode. When Autocommit is set to ON, the Autocommit check box in the
toolbar is selected. To turn Autocommit OFF, clear the check box.
Connect to Selected Profile
Connects to the connection profile, if it is disconnected.
Commit
If Autocommit is off, performs a commit.
Rollback
If Autocommit is off, performs a rollback.
Max Rows
Changes the maximum number of rows returned by SQL executed in this editor.
SQL Execution Options
Displays a list of Execute options. You can select to Execute an Individual Statement that you have
selected, or to Execute All query statements in the editing pane.
Cancel Running Statements
Aborts a running SQL request.
Save Options
Saves the SQL file to a project.
Export Results to File
When toggled on, exports the SQL results to a file instead of displaying in the Result Set viewer.
Import Data to Volatile Table
Lets you load external data into a volatile table.
Clear Query
Clears the SQL displayed in the editor.
Rename Editor
Renames the editor.
View Result Sets
View result sets created by this editor.
SQLA Substitution
When toggled on, performs a direct string substitution for parameters in the SQL Editor, similar to SQL
Assistant functionality. When the SQL is executed a popup dialog appears for the user to enter the
substitution for a named parameter in queries. Pertains to Teradata Database and Aster 6 and later
systems, not Hadoop.
New SQL Editor
Opens a new SQL Editor. This action does not close the current editor, enabling you to work with
multiple editors in tandem.
SQL Handling Preferences
Opens the SQL Handling Preferences.

Teradata Studio User Guide, Release 16.00 137


Chapter 5: Query Development
Teradata SQL Editor

SQL Handling
Common
The Results Handler options enable you to select a result set handler to process SQL result sets.

Option Description
Qualify names for drag and drop in SQL Editor (Default) Clear this check box if you do not want
names qualified when you drag and drop objects
from the Data Source Explorer to the SQL Editor.
Prompt for notes Check this check box if you want to be prompted to
enter SQL execution notes. When you execute SQL
statements, a dialog appears which prompts you to
enter the note. The SQL History view displays your
note text in the Note column.
Auto-connect to profile when selected in SQL Select this check box to automatically connect to the
Editor selected profile within an instance of the SQL
Editor. (Default)
Results Handler Select one:
• Teradata Export Wizard (File Export) —
option handles result sets by exporting SQL to a
file using the Teradata Export Wizard .
• (Default) Teradata Result Set Viewer — option
displays SQL result sets in the Result Set Viewer.

Sampler Content Size Type a value for the sample content size. Default is
100.

Teradata
The following Large Value Handling settings enable you to set column size restrictions for creating BLOBs
and CLOBs in Teradata tables.

Option Description
Handle Binary/Byte columns as BLOBs if size > Specify the limits for creating BLOBs for large binary
values in results. Binary results are treated as BLOBs
when their column size is greater than the value you
enter. A value of zero specifies that all binary values
are treated as BLOBs. Default is 30.
Handle Character columns as CLOBs if size > Specify the limits for creating CLOBs for large
character values in SQL results. Character values in
results are treated as CLOBs when their column size
is greater than the value you enter. A value of zero
specifies that all character values are treated as
CLOBs. Default is 16384.

138 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
Aster
The following Large Value Handling settings enable you to set size restrictions for creating BLOBs and
CLOBs in Aster tables

Option Description
Handle Binary/Byte columns as BLOBs if size > Specify the limits for creating BLOBs for binary
results. Binary results are treated as BLOBs when
their column size is greater than the value you enter.
A value of zero specifies that all binary values are
treated as BLOBs. Default is 30.
Handle Character columns as CLOBs if size > Specify the limits for creating CLOBs for results.
Character values in results are treated as CLOBs
when their column size is greater than the value you
enter. A value of zero specifies that all character
values are treated as CLOBs. Default is 2147483647.

Sounds
The Sounds settings enable you to customize audible indicators for success and failure notification sounds
during SQL execution.

Option Description
Success Sound Select one of these options:
• No sound (default)
• System Beep
• Secret Sound
If you select Secret Sound, click Browse to select a
sound file on your system.
Failure Sound Select one of these options:
• Success Sound
• No sound (default)
• System Beep
• Secret Sound
If you select Secret Sound, click Browse to select a
sound file on your system.

BLOB Disposition
The BLOB Disposition form appears in the LOB Disposition Dialog when the results contain columns with
large binary values. The form contains the following fields:
Field Description
Column Name View the name of the column in the results.
Save to File Saves the values of the column to files. When this check box is cleared the fields
for specifying the name and location of files are unavailable.

Teradata Studio User Guide, Release 16.00 139


Chapter 5: Query Development
Teradata SQL Editor

Field Description
Display images in Displays the values that can be decoded as images in the result view as images.
Result View
Location Enter the name of the folder where the files are to be saved.
Browse Click to display a dialog box that allows you to browse for the Location.
File Base Name This is the main component of the name of the files that are created for the large
objects. The final name consists of the base name, the number of the row in the
results that contains the value, and the File Extension.
File Extension File extension component of the name of the files that are created for the large
objects.

CLOB Disposition
The CLOB Disposition form appears in the LOB Disposition Dialog when the results contain columns with
large character values. The form contains the following fields:
Field Description
Column Name View the name of the column in the results. This field can not be modified.
Save to File Saves the values of the column. When this check box is cleared, the fields for
specifying the name and location of files are unavailable.
Location Type the name of the folder where the files are to be saved.
Browse Click to browse for the folder to be the Location value.
File Base Name Base name to give to the files created for the large objects. The final name
consists of the base name, the number of the row in the results that contains the
value and the File Extension.
File Extension File extension to give to the files created for the large objects.
File Encoding Name of the encoding to use when the character values are written to the files.

LOB Disposition

The LOB Disposition dialog appears when the results of running an SQL statement contain CHARACTER
LARGE OBJECT (CLOB) or BINARY LARGE OBJECT (BLOB) values, or character or binary values
specified to be treated as large objects.
The dialog contains a form for each column of the results that is a large object type. The forms enable you to
specify how to handle the values. You can specify to store the values in files. In the case of binary data, you
can specify that the values that are images are displayed in the Result View.
The forms for specifying how the values are to be handled are:
• CLOB disposition: Specify the handling of large character values
• BLOB disposition: Specify the handling of large binary values
As you enter values in the forms, the message at the top of the dialog indicates if there is an invalid value.
When a form contains an invalid value the OK is disabled.

140 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
Clicking Cancel displays a dialog that indicates large values are not saved to files.

Setting SQL Handling Preferences


Use the SQL Handling Preferences dialog to set very large value handling rules for objects, such as BLOBs,
CLOBs, and LOBs, in the SQL Editor.
1. Click Window in the top menu and select Preferences.
2. In the Preferences navigation pane, expand Teradata Datatools Preferences.
3. Select SQL Handling.
The SQL Handling dialog displays in the right pane. There are three tabs: Common, Teradata, and
Aster.
4. Click the Common tab to set SQL rules for both Teradata Database and Aster database.
a) Select Qualify names for drag and drop in SQL Editor to qualify names when objects are dragged
from the Data Source Explorer and dropped in the SQL Editor.
Clear this check box if you do not want names qualified.
b) Select Prompt for notes to be able to enter a note when you execute SQL.
The Note dialog lets you enter a text value that displays in the Teradata SQL History view in the
Note column.
c) Under Results Handler, the Teradata Result Set Viewer is selected as the results handler for
processing SQL result sets.
5. Click the Teradata tab to set large value handling rules in Teradata Databases.
a) In Handle Binary/Byte columns as BLOBs if size >, type the number of bytes for column size
which when exceeded, the object is handled as a binary large object (BLOB).

Note:
A value of zero specifies that all binary values are handled as BLOBs.
b) In Handle Character columns as CLOBs if size >, type the number of characters which when
exceeded, the object is handled as a character large object (CLOB).
The default is 2147483647.

Note:
A value of zero specifies that all character values are handled as CLOBs.
6. Click the Aster tab to set large value handling rules in Aster databases.
a) In Handle Binary/Byte columns as BLOBs if size >, type the number of bytes for column size
which when exceeded, the object is handled as a binary large object (BLOB).

Note:
A value of zero specifies that all binary values are handled as BLOBs.
b) In Handle Character columns as CLOBs if size >, type the number of characters which when
exceeded, the object is handled as a character large object (CLOB).
The default is 2147483647.

Note:
A value of 0 (zero) specifies that all character values are handled as CLOBs.
7. [Optional] To clear selections and restore default settings, click Restore Defaults.
8. To apply your changes, click Apply.
9. Click OK to apply your changes and close the Preferences dialog.

Teradata Studio User Guide, Release 16.00 141


Chapter 5: Query Development
Teradata SQL Editor

Execute SQL
The SQL Editor provides various options to execute SQL statements within an SQL file. To access the
following options, click the appropriate button in the toolbar or right-click inside the SQL Editor text area.

Option Label Description


Execute as Individual Executes all statements or selected statements one at a
Statements time, displaying the result as a Teradata Group Execution
in the SQL Results view. This option allows you to
execute SQL DDL statements, which requires its own
COMMIT between statements. The group result includes
an individual SQL Result for each statement.
Execute All Executes all SQL statements in the SQL File and displays
the result as a single entry in the SQL Results view.
Multiple result sets display in multiple Result tabs.

Running SQL
Teradata Studio has the following ways to run SQL operations on your Teradata systems:
• The SQL Editor provides the ability to define and run SQL statements. See the Using the SQL Editor
topic for details of how to run SQL statements from the SQL Editor.
• Run Configurations let you define operations that you can run from the Run menu and Run toolbar
button. See the Running SQL from Run Menu and Toolbar topic for details of how to specify run
configurations and how to run them.
• Running database objects - Several types of objects can be "run" in from the Data Source Explorer. See
the following section for details.

Running Database Objects


Another way that operations can be performed in the database is by using the Run menu item in the pop-up
menu shown when you right-click certain objects in the Data Source Explorer tree.
The types of objects that can be Run from the Data Source Explorer are (followed by the result of selecting
Run):
• Stored Procedures - Displays the Configure Parameters dialog box where the procedure's parameters are
specified. The Stored Procedure is called with the specified parameters. The values of the parameters after
the call is completed, including the OUT and INOUT parameters, are shown in the Parameters tab of the
SQL Results view.
• User-defined Functions - Displays the Configure Parameters dialog box where the procedure's
parameters are specified. The UDF is SELECTED with the specified parameters. The values of the
parameters are shown in the Parameters tab of the SQL Results view. The value of the UDF is shown in
the Result1 tab.
• Macros - Displays the Configure Parameters dialog box where the procedure's parameters are specified.
The macro is executed with the specified parameters. The results of the macro are shown in the Result
tab(s) of the SQL Results view.
• Triggers - Displays the Edit Configuration dialog box where the SQL statement that performs the
operations that causes the trigger to be run is specified. The specified SQL statement is run and the
results of the SQL operation are shown in the SQL Results view.

142 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
When SQL operations are performed using the Run menu item, a launch configuration specifying the way
the operation was run is created. See the Running SQL from Run Menu topic for details of how to rerun, edit
and remove the automatically created launch configurations.

Format SQL Command


The Format SQL toolbar command formats the SQL statement in the SQL Editor. The formatter uses the
formatting options specified in the SQL Formatter Preferences. The SQL Formatter Preferences are
available from Window > Preferences > Teradata Datatools Preferences in the main menu.

Set Connection Information


The Set Connection Info menu option changes the Connection Profile for an SQL Editor file. You can
select the database server type, connection profile name, and database name from the drop down lists then
click OK.

SQL Editor Templates


SQL templates for creating SQL statements in the SQL Editor are provided in three ways:
• Generate SQL options — SELECT, INSERT, UPDATE, and DELETE statement templates for tables.
These Generate SQL options are available from the Query Development perspective when you right-click
a table object in Data Source Explorer.
• Content Assist templates — In-context insertion of SQL statements in SQL Editor. To invoke the SQL
Templates, place your cursor at the point in the SQL text where you want assistance and enter CNTL
+SPACE.
• Templates View for Aster analytical functions — Aster-only view that displays a list of function
templates you can drag and drop into the SQL Editor.
Templates provided through the Content Assist mechanism help you create Data Manipulation Language
(DML) type SQL statements, such as DELETE, INSERT, SELECT, and UPDATE. Template variables support
tabbing from one variable to another. Template variables are linked allowing you to change one occurrence
of a variable, for example, tablename1, and automatically change all occurrences of that same variable in
the template. The Content Assist selection list includes all available SQL templates for creating SQL at the
cursor insertion point in the text.

Retrieving Table Rows using a SELECT Template

1. Click Query Development to open the Query Development perspective.


2. Open the Data Source Explorer and navigate to the Teradata or Aster database table in which you want
to insert rows.
3. Right-click the table object and select one of these options:
For Select
Teradata Database Teradata > Generate SQL > SELECT Statement
Aster Database Aster > Generate SQL > SELECT Statement

Teradata Studio User Guide, Release 16.00 143


Chapter 5: Query Development
Teradata SQL Editor

For Select
Hadoop File System Hadoop > SELECT Statement
4. In the SQL Editor, review the generated SELECT statement and edit as needed.

5. Click to execute the SELECT statement to retrieve the row in the table.

Inserting Table Rows using an INSERT Template


You can generate an INSERT statement template in the SQL Editor that inserts rows in a Teradata or Aster
database table. The INSERT (Values) Statement menu option enables you to modify the generated
statement and provide all query values. If you want to create a parameterized query, select the INSERT
(Parameterized) Statement menu option.
1. Click Query Development to open the Query Development perspective.
2. Open the Data Source Explorer and navigate to the table in which you want to insert rows.
3. Right-click the table object and select one of these options:.

For Select
Teradata Database Teradata > Generate SQL > INSERT (Values) Statement
Aster Database Aster > Generate SQL > INSERT (Values) Statement
4. In the SQL Editor, modify the generated INSERT statement to specify the values for the columns based
on data types.

5. Click to execute the INSERT statement to insert the row into the table.

Inserting Table Rows using Parameterized Queries


You can generate an INSERT statement template in the SQL Editor that uses parameter placeholders in
those cases where you could specify constants. When you execute the SQL, the editor prompts you to specify
the values for each of the parameter placeholders. You also have the option to load the default values for the
parameters.
1. Click Query Development to open the Query Development perspective.
2. Open the Data Source Explorer and navigate to the database table in which you want to insert rows.
3. Right-click the table object and select one of these options:.

144 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor
For Select
Teradata Database Teradata > Generate SQL > INSERT (Parameterized) Statement
Aster Database Aster > Generate SQL > INSERT (Parameterized) Statement
4. In the SQL Editor, review the generated INSERT statement and edit as needed.

5. Click to execute the INSERT statement.


6. In Configure Parameters, specify the values for each of the parameters or click Load Defaults to specify
default values.
7. Click OK.
The SQL INSERT statement runs and inserts the row in the table.

Parameterized Queries
SQL statements can contain parameter placeholders (question marks) in most cases where you can specify
constants. When you run SQL that contains one or more parameter placeholders from the SQL Editor, you
are prompted to specify the values for each of the parameters. The values you specify are substituted for the
parameter placeholders when the SQL executes.

Named Parameters
A special SQL element in the SQL Editor enables you to assign names to parameter placeholders. The form
of the new element is: ?\name
This form follows the rules of forming unquoted names which is a question mark followed by a back slash
followed by a name with no space between the parts.
Parameters that are specified without a name, that is, by using just the question mark alone, display with the
name "Parameter n" where the n indicates the index of the parameter for the SQL value.
For character string or binary columns, the Configure Parameters dialog provides a From File option
which reads the input value from a file. To specify the input file, select the cell ellipsis (...) and display a
dialog in which you can specify the input file.

Reexecuting Parameterized Queries


When you select an entry in the list of operations in the SQL Results view that is produced by running
parameterized SQL and select Reexecute from the context menu, you are presented with a dialog for
specifying the parameter values. The dialog initially contains the values that were used to produce the
results.

Teradata Studio User Guide, Release 16.00 145


Chapter 5: Query Development
Teradata SQL Editor
Updating Table Rows using an UPDATE Template
You can generate an UPDATE statement template in the SQL Editor to update table rows.
1. Click Query Development to open the Query Development perspective.
2. Open the Data Source Explorer and navigate to the database table in which you want to delete rows.
3. Right-click the table object and select one of these options:

For Select
Teradata Database Teradata > Generate SQL > UPDATE Statement
Aster Database Aster > Generate SQL > UPDATE Statement
4. In the SQL Editor, review the generated UPDATE statement and optionally add conditions to the
WHERE clause to update rows.

5. Click to execute the UPDATE statement and update the row in the table.

Deleting Table Rows using a DELETE Template


You can generate a DELETE statement template in the SQL Editor to delete rows in an Aster Database
table.
1. Click Query Development to open the Query Development perspective.
2. Open the Data Source Explorer and navigate to the Teradata or Aster database table in which you want
to delete rows.
3. Right-click the table object and select one of these options: .

For Select
Teradata Database Teradata > Generate SQL > DELETE Statement
Aster Database Aster > Generate SQL > DELETE Statement
4. In the SQL Editor, review the generated DELETE statement and optionally add conditions to the
WHERE clause to delete rows.

146 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Teradata SQL Editor

5. Click to execute the DELETE statement and delete the row in the table.

Inserting Aster Analytical Functions


The Aster Database includes scripts for analytical function templates that you can insert into the SQL
Editor.
1. Select a connection profile that connects to an Aster Database.
2. Click Query Development and launch the SQL Editor.
The SQL Editor, Result Set Viewer, and Teradata SQL History views open.
3. In the main toolbar, select Windows > Show View > Other
The Show View dialog opens.
4. Scroll up to General and select TemplatesView which is located at the bottom of the list.
The Templates View opens below the SQL Editor. You can drag and dock the view in the left pane
beside the Data Source Explorer to see the full list easily.

5. Select a function in the Templates View and preview the script text in the Preview area below the view.
6. Drag and drop the selected Aster function into the SQL Editor to insert it.
The text for the Aster analytical function displays at the point you drop it in the SQL Editor script.
7. Substitute your values for the template variables and execute the script.

Teradata Studio User Guide, Release 16.00 147


Chapter 5: Query Development
About Teradata SQL Query Builder

About Teradata SQL Query Builder


Teradata SQL Query Builder extends the Eclipse Data Tools Platform SQL Query Builder to provide
execution on Teradata. SQL Query Builder provides a graphical interface to create, edit, or run SQL
statements. It provides access to your database schema and objects so that you can quickly create or edit SQL
statements without actually typing any SQL code. You also have the flexibility to add or modify the SQL
code in the editor window.
You can open the Teradata SQL Query Builder in the SQL Editor by right-clicking an SQL file in the
Project Explorer and choosing the Open With option, then selecting Teradata SQL Query Builder from
the list of Editor choices.

Note:
You must have a Connection Profile assigned for the SQL file.

Note:
Some syntactic variations might exist between Teradata SQL syntax and the SQL syntax that the Eclipse
DTP SQL Query Builder supports; consequently, some SQL Query Builder features might not work with
Teradata SQL syntax. For example, Teradata allows for abbreviated keywords such as "sel" for "select", or
"ins" for "insert", which the DTP SQL syntax does not support.

Note:
Also, if multiple SQL statements exist in the file, SQL Query Builder uses the first statement and ignores
the rest. It also does not handle nested SELECT statements. The Teradata SQL Query Builder supports
four types of SQL statements:
SQL Statement Type Description
SELECT Creates a SELECT statement to retrieve data from a database and displays the
result set in a table format.
INSERT Creates an INSERT statement to insert rows into the table.
UPDATE Creates an UPDATE statement to update data in a table.
DELETE Creates a DELETE statement to remove data from a specified table.

The SQL Query Builder provides tabs to edit the Columns, Conditions, Groups and Group Conditions.
Right-clicking the graphical area background provides options to add tables or create joins. Right-clicking a
table provides options to add a table, create a join, replace a table, select all columns, deselect all columns,
update an alias, and remove a table. You can also drag table objects from the Data Source Explorer and
drop them in the graphical display of the SQL Query Builder to easily add tables to your SQL statement.
The SQL Query Builder can also be launched from the SQL Editor context menu by selecting a SQL
statement then choosing the option Edit in SQL Query Builder. The SQL Query Builder displays the SQL
statement as well as a graphical view of the tables, columns, and table joins.

Note:
If you select an existing statement to edit in the SQL Query Builder, make sure that the tables are
qualified with the database name or that the designated database from the Connection Profile is the
database involved in the SQL statement. Otherwise the SQL Query Builder does not recognize the
columns and table joins for the graphical display. Also, if you perform a "SELECT *", the columns are not
selected (checked) in the graphical view of the table. Only columns specifically named in the query are
selected (checked) in the graphical view of the table.

148 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Result Set Viewer
An Outline Viewer is displayed to the right of the graphical display. This shows a high-level outline view of
the SQL Statements.

Result Set Viewer


The Result Set Viewer provides an enhanced view of the result set, including options to hide columns, filter
on column values, find column values, copy data to the clipboard, format cell data, and switch between grid
and text view. The result set is displayed in its own view with its own toolbar.
You can change preferences to customize the view by, for example, displaying alternating row background
colors, enabling or disabling row numbers, column headers, table grid lines, and thousand separator on
numeric columns. You can change the max display row count, as well as the display null value and date
format. Refer to Result Set Viewer Preferences for more detailed information of the Result Set Viewer
preferences.
The Single Result Set Toolbar contains:
Icon Option Description
Preferences Click to open the Result Set Viewer Preferences page.

Show SQL Click to open a dialog that displays the SQL statement.

Set Focus Click to set the focus to the associated SQL editor.

Rename Result Click to open a dialog that allows you to rename the result tab.
Tab
Text or Grid Click to switch the view of the result set data between grid or text.
Display The default is grid.
Format Selected Click to open the platform specific Font dialog which enables you
Cells to select the font, size, and color (on most platforms) of the selected
cells.
Pin Result Set Click to pin the result set. Pinned result sets are not closed by the
Clear All action. Pinned result sets must be closed manually.
Clear All Click to clear all result sets in the Viewer.

Save Click to save the result set data to a file within the workspace. The
Eclipse Save Result dialog appears, which allows you to select the
project, file name, file type, and export options.
Export Click to export the result set data to an external file. The Eclipse
Export Result dialog appears, which allows you to select the file
name, format, and export options.
Print Click to print the result set data. The Eclipse Print dialog appears,
which allows you to select the printer, page range, and number of
copies.

The Multiple Result Sets Toolbar contains:

Teradata Studio User Guide, Release 16.00 149


Chapter 5: Query Development
Result Set Viewer

Icon Option Description


Preferences Click to open the Result Set Viewer Preferences page.

Show SQL Click to open a dialog that displays the SQL statement.

Rename Result Click to open a dialog that allows you to rename the result tab.
Tab
Rename Group Select one of the group result tabs while in Tab display mode.
Result Tab Right- click the tab and select the Rename Group Result tab menu
option.
Text or Grid Click to switch the view of the result set data between grid or text.
Display The default is grid.
Sash or Tab Click to switch the display of the multiple result sets between a tab
Display folder or side-by-side sash framework. The default is tab folder.
You can remove a result set from the sash framework by clicking
the .

Note:
When result sets are displayed in a sash framework, you can not
select a single result set for export, save, or print options.

Pin Result Set Click to pin the result set. Pinned result sets are not closed by the
Clear All action. Pinned result sets must be closed manually.
Refresh Result Set Click to refresh all of the removed result sets.
List
Save Click to open to the Eclipse Save Result dialog which allows you to
select the project, file name, file type, and export options and save
the selected result set to a file within the workspace.

Note:
This option is unavailable when result sets are displayed in the
sash framework.

Save All Click to open the Eclipse Save Result dialog which allows you to
select the project, file name, file type, and export options and save
all of the result sets to a file within the workspace. This option is
enabled when you execute multiple SQL statements in a single
execution, using the following SQL Editor menu options: Execute
All, Execute Select Text (and more than one SQL statement is
selected), or Execute Selected Text as One Statement.
Export Click to open the Eclipse Export Result dialog which allows you to
select the file name, format, and export options and export the
selected result set to an external file. This option is unavailable
when result sets are displayed in the sash framework.
Export All Click to open the Eclipse Export Result dialog which enables you
to select the file name, format, and export options and export all of

150 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Result Set Viewer

Icon Option Description


the result sets to an external file. This option is enabled when you
execute multiple SQL statements in a single execution, using the
following SQL Editor menu options: Execute All, Execute Select
Text (and more than one SQL statement is selected), or Execute
Selected Text as One Statement.
Print Click to open the Eclipse Print dialog which enables you to select
the printer, page range, and number of copies to print the selected
result set. This button is disabled when result sets are displayed in
the sash framework.
Print All Click to open the Eclipse Print dialog which enables you to select
the printer, page range, and number of copies to print all of the
result sets. This option is enabled when you execute multiple SQL
statements in a single execution, using the following SQL Editor
menu options: Execute All, Execute Select Text (and more than one
SQL statement is selected), or Execute Selected Text as One
Statement.

The Grid Menu contains:


Icon Option Description
Hide Column Click to hide the selected column

Show All Click to show all columns. Previously hidden columns are also
Columns shown.
Select Column Click to select the entire column.

Auto resize Click to resize the column to fit the largest cell.
column
Auto resize row Click to resize the row to fit the largest cell.
Rename column Click to rename the column header.

Find Click to search for a result set data value.

Find Next Click to find the next match value in the result set data.
Find Next Reverse Click to find the next match value in the result set data in the
reverse direction.
Aggregates Click to compute aggregates for the selected column values.

Filter column Click to create a filter on the column data.

Remove filters Click to remove filters for the column.

Freeze column Click to freeze scrolling at the selected column. All columns to the
left are displayed. All columns to the right are scrolled. To unfreeze,
click again.

Teradata Studio User Guide, Release 16.00 151


Chapter 5: Query Development
Result Set Viewer

Icon Option Description


Format Selected Click to open the platform specific Font dialog which enables you
Cells to select the font, size, and color (on most platforms) of the selected
cells.
Copy Cells Click to copy the cell data to the clipboard. The default is to copy
the cell data into an HTML table. You can copy cells to Excel,
Word, or an email.

The Text Display Menu contains:


Icon Option Description
Copy Click to copy the selected text to the clipboard. The text is copied as
a string to the clipboard.
Select All Click to select the entire text string displayed.
Find Click to search for a result set data value within the text string.

Find Next Click to find the next match value in the result set data.

Other Actions:
Option Description
Sort Column Click the column header. An arrow appears indicated the direction of the sort,
ascending or descending order. Clicking a third time returns the column back to its
original order.
Move Column Select a column and drag it just past the new position.
Long Text Display If a cell contains text that exceeds the length specified by the Long Text Boundary
Size in the Result Set Viewer Preference, only the first 20 characters of the text is
displayed. Double-click the data to display the full text.
LOB Display When a result set contains CLOBs (Character Large Objects) or BLOBs (Binary
Large Objects), a dialog appears that enables you to indicate whether to save the
LOB to a file and the file location, as well as whether to display images in the Result
View.

Result Set Viewer Preferences


The Result Set Viewer Preferences dialog enables you to set display options for result set data.

Result Display Tab

Option Description
Display alternate Result Set Displays color in alternate rows of the result set. Click the color box to
rows in color open the Color dialog and select a basic color or define a custom color
to use.
Show Row Numbers Displays row numbers. This option is enabled by default.

152 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Result Set Viewer

Option Description
Show Column Headers Displays column headers. This option is enabled by default.
Show Table Grid Lines Displays lines between rows and columns on the table grid. This option
is enabled by default.
(*) Display Column Titles Displays the column titles (if available) rather than the column names,
rather than Column Names in the column header area. This option is disabled by default. The query
must be rerun in order for a change to this option to take effect.
(*) Max Display Row Count Changes the maximum number of rows to display. The default for this
option is 2000. The query must be rerun in order for a change to this
option to take effect.
Long Text Boundary Size Changes the long text boundary size. If a data value length is longer than
the long text boundary size, only the first 20 characters are displayed.
The user can view the entire data value by double-clicking the data in
the display grid. A pop-up window is presented with the full data value.
The default for this option is 150.
Display Negative Numbers in Displays negative numbers in red. This option is enabled by default.
Red
Reuse Result Set Viewer Causes the Result Set Viewer to refresh the current window with new
Window result sets generated by the SQL Editor. If you deselect the box, the
Result Set Viewer creates a new window for each generated result set.

Data Format Tab

Option Description
Display Null Value as Changes the value that is displayed when the data is null. The default for
this options is "null."
Display 1000 Separator in Displays a 1000 separator in numeric columns. This option is disabled
Numeric Columns by default.
Number Fractional Digits Designates the number of decimal places to display for Float values. By
Displayed default, the value is blank and the data is presented as returned from the
database. Set the value between 1 and 10 to change the number of
fractional digits displayed.
Display Dashes between Bytes Displays a dash between each byte of the value for greater ease of
for Binary Data Values reading, for example: 63-b1-a3-62. This option is enabled by default.
Display Float Values using Displays Float values using scientific notation rather than in decimal
Scientific Notation format. This option is disabled by default.
Display Time/Timestamp Displays the time/timestamp without indicating the time zone. For
without Time Zone example, instead of 11:37:58.123+02.00 this Results Set Viewer
would show 11:37:58.123. This option is disabled by default.
Display Date Format Select the format in which you want dates to be displayed. This option
uses the Java Simple Date Format notation to format the date display in
the result set. The default for this option is yyyy-MM-dd. You can select

Teradata Studio User Guide, Release 16.00 153


Chapter 5: Query Development
Result Set Viewer

Option Description
User Defined if you want to enter a format in the Date Format
Value box.
Date Format Value Shows the notation used to display date formats, based on the selection
in the Display Date Format drop-down list and enables you to enter a
format if you selected User Defined.

Copy Options Tab

Option Description
Delimiter Format Changes the column delimiter when the Copy data option is used on the
grid display. The default for this option is Comma Separated. Other
possible choices are Tab Separated and User Defined.
Delimiter Value Changes the column delimiter value when the User Defined format
option is selected.
Copy Include Column Headers Select to include column headers when the copy data option is used on
the grid display.
Copy Include Grid Lines Select to include cell borders when you use the Copy data option to
copy cells from the grid display.

Setting Result Set Viewer Preferences


Use the Teradata Result Set Viewer preferences to configure the display of result set data.
1. Click Window in the main menu and select Preferences.
2. Expand Teradata Datatools Preferences.
3. Click Result Set Viewer Preferences.
4. In the Result Display tab, select the following options as appropriate:

Option Description
Display alternate Select the check box to display color in alternate rows of the result set. Click
Result Set rows in the color box to open the Color dialog and select a basic color or define a
color custom color to use. This option is disabled by default.
Show Row Numbers Select to show row numbers in the grid display. This option is enabled by
default.
Show Column Headers Select to show column headers in the grid display. This option is enabled by
default.
Show Table Grid Lines Select to display lines between rows and columns in table grid display. This
option is enabled by default.
(*) Display Column Select to display column titles (if available) instead of column names as labels
Titles rather than in column headers. This option is disabled by default.
Column Names
Note:
You must rerun the query for these changes to take effect.

154 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Result Set Viewer
Option Description
(*) Max Display Row Specify the maximum number of rows to display. The default value is 2000.
Count
Note:
You must rerun the query for these changes to take effect.

Long Text Boundary Enter the number of characters that will be displayed. The default for this
Size option is 150.
Display Negative Select to enable display of negative numbers in red. This option is enabled by
Numbers in Red default.
Reuse Result Set Select to refresh the current window with new result sets generated by the
Viewer Window SQL Editor. If deselected, the Result Set Viewer creates a new window for
each result set generated.
5. In the Data Format tab, select the following options as appropriate:

Option Description
Display Null value as Specify the value or string you want displayed when a value results in an
empty set or zero value. The default value is null.
Display 1000 Select to display a 1000 separator in numeric columns. This option is disabled
Separator in Numeric by default.
Columns
Number Fractional Enter the number of decimal places to display for Float values. By default, the
Digits Displayed value is blank. The number must be between 1 and 10.
Display Dashes Select to display a dash between each byte of the value for greater ease of
between Bytes for reading, for example: 63-b1-a3-62. This option is enabled by default.
Binary Data Values
Display Float Values Select to display Float values using scientific notation rather than in decimal
using Scientific format. This option is disabled by default.
Notation
Display Time/ Select to display the time/timestamp without indicating the time zone. For
Timestamp without example, instead of 11:37:58.123+02.00 the Results Set Viewer would
Time Zone show 11:37:58.123. This option is disabled by default.
Display Date Format Specify the format to use to display the date in the result set. Default format is
yyyy-mm-dd. When you specify the format, you must use the Java
SimpleDateFormat notation to format the date.
Date Format Value If you selected User Defined for the Display Date Format option, enter the
format.
6. In the Copy Options tab, select the following options as appropriate:

Option Description
Delimiter Format Select how you want columns delimited when the Copy data option is used on the
grid display:

Teradata Studio User Guide, Release 16.00 155


Chapter 5: Query Development
Result Set Viewer
Option Description

• Comma Separated: Uses commas as delimiters to separate column data


(default).
• Tab Separated : Uses tabs as delimiters to separate column data.
• User Defined: Enter the delimiter you want to use in the Delimiter Value
field.

Copy Include Select to include column headers as delimited values when the Copy data option is
Column Headers used on the grid display.
Copy Include Select to include grid lines as delimited values when the Copy data option is used
Grid Lines on the grid display.
7. [Optional] To clear selections and restore default settings, click Restore Defaults.
8. To apply your changes, click Apply.

Note:
Clicking Apply or OK refreshes the current display of result sets in the Result Set Viewer to
correspond with your changes.
9. Click OK to apply your changes and close the Result Set Viewer Preferences dialog.

Results Preferences
The Results Preferences provide extended capabilities for exporting results.
Option Description
Excel Export Options Alternate Row Colors: — Select this check box to alternate row
background colors when exporting to Excel. Select a different background
color by clicking color. The default for this option is cleared.
Big Int/Decimal Format: — Select the output format for Big Integers and
Decimals. If you choose number, some precision may be lost. The default
for this option is String.
Success Sound Select the sound that is played when results are successfully loaded into the
Result Set Viewer. The default for this option is no sound.
No Sound: — Play no sound when results are successful.
System Beep: — Play a system beep when results are successful.
Select Sound: — Play a sound file of your choosing when results are
successful.
Sound File: — Choose a sound file to play when results are successful.
Failure Sound Select the sound that is played when results fail to load into the Result Set
Viewer. The default for this option is no sound.
Success Sound: — Play the same sound as successful results.
No Sound: — Play no sound when results failed.
System Beep: — Play a system beep when results failed.
Select Sound: — Play a sound file of your choosing when results failed.
Sound File: — Select the sound file to play when results fail.
Restore Defaults Restore the default values for the options.

156 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Result Set Viewer

Option Description
Apply Apply any option changes that have been made. This may cause a refresh of
the current result sets displayed in the Result Set Viewer.
OK Applies any option changes that you made and closes the preferences page.
This may cause a refresh of the current result sets displayed in the Result
Set Viewer.

Formatting the Foreground in Selected Cells


In the Result Set Viewer you can change the foreground of selected cells. You can reset your selections to
default settings by clicking the (Format result set) icon on the toolbar.
1. In the Result Set Viewer, select cells in the result set table.
2. Right-click the selected cells, and select Format Foreground of Selected Cells.
3. Select the foreground options you want for the selected cells.
4. Click OK.
The foreground changes you select are applied to the selected Result Set Viewer cells.

Formatting the Background in Selected Cells


In the Result Set Viewer you can apply background formatting to selected cells in the result set table. You
can reset your selections to default settings by clicking the (Format result set) icon on the toolbar.
1. In the Result Set Viewer, select cells in the result set table.
2. Right-click the selected cells, and select Format Background of Selected Cells.
3. Select the background color you want for the selected cells.
4. Click OK.
The background color changes are applied to the selected Result Set Viewer cells.

Java Simple Date Format


The Java Simple Data format uses the following symbolic notation for Date formatting:
Symbol Definition Example
G Era "GG"-> "AD"
y Year "yy" -> "033 "yyyy" -> "20033
M Month "M" -> "73 "M" -> "123 "MM" ->→
"December"
d Day in month "d" -> "33 "dd" -> "033
E Day in week "EEE" -> "Tue" "EEEE" -> "Tuesday"
D Day in year (1-365 or 1-364) "D" -> "653 "DDD" -> "0653
F Day of week in month (1-5) "F" -> "13
w Week in year (1-53) "w" -> "73

Teradata Studio User Guide, Release 16.00 157


Chapter 5: Query Development
SQL History View

Symbol Definition Example


W Week in month (1-5) "W" -> "33

SQL History View

SQL History Form


The SQL History form provides an enhanced display of the history information. As you execute SQL
statements from the SQL Editor or run functions from the Data Source Explorer, an entry is added to the
SQL History list.
The history displays extensive information about each SQL execution. It includes execution elapsed time,
DBMS time, fetch time, database server, row count, parameter display for macros and stored procedures,
SQL statement, and SQL statement type.
The SQL History form displays the data in a grid format that lets you select rows or cells. It provides options
to copy cells or rows, sort columns, delete rows, edit the note or SQL for a history entry, filter columns,
search for result history data, format the display, and re-execute SQL statements.
The SQL History uses an embedded Derby Database to manage the SQL History entries.
If you close the form and need to re-open it, go to Window > Show View > Other > SQL History.
You can add notes manually by clicking on the Note column value. You can also choose to be prompted to
add notes when you execute the SQL. Set the Prompt for notes option using the SQL Handling
preferences.
You can sort columns in ascending and descending order with the exception of the Parameters column. For
single column sorting, left-click the mouse button. For multi-column sorts, note the following:
• Columns are movable and re-sizable. Many of the columns are grouped together under a collapsible
header.
• Rows can be selected by clicking in the numbered row header.
• Column order, collapsed columns, filter, sort, and formatting are preserved from session to session.
• If a filter is in effect, the result of a newly executed SQL statement is inserted as the top row, regardless of
whether it meets the filter criterion. If a sort is in effect the new entry is inserted in the sorted order.
• The Result column contains a summary of the executed SQL operation. To read the entire contents in a
column cell, hover the mouse pointer over the cell. Error results show as red text in the resulting tool tip
display. The following examples are samples of the Result summary.
• Example 1: In this example a single statement was executed successfully. Executed as Single
statement. >Elapsed time = 00:00:00.108 STATEMENT 1: Select Statement
completed. 26 rows returned.
• Example 2: In this example the executed statement failed. This statement also has this icon associated
with it. Executed as Single statement. Failed [3807 : 42S02] Object 'bogus' does
not exist. Elapsed time = 00:00:00.145 STATEMENT 1: Select Statement failed.
• Example 3: In this example the executed statement was canceled. This statement also has this icon
associated with it. Executed as Single statement. Canceled. Elapsed time =
00:00:00.000 STATEMENT 1: Select Statement canceled.

158 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
SQL History View
Toolbar Actions

Icon Option Description


Delete Selected Rows Deletes selected row(s) from the view and
history database.
Filter history display Opens a dialog to filter the display.

Export history Opens a dialog to export history view


items to XML file.
Import history Opens a dialog to import history items
from either a previously exported XML
history file or SQL Assistant history file.
Cleanup history Opens a dialog to clean up SQL history
records based on selected criteria.
Format History View Enables you to format the display. The
platform-specific Font dialog allows you
to select the font, size, and color (on most
platforms).
Sort history display Opens a dialog for setting a multi-column
sort.

Toolbar Menu Options

Icon Option Description


Delete Selected Rows Deletes selected row(s) from the view and
history database.
Export history Opens a dialog to export history view items to
an XML file.
Import history Opens a dialog to Import history items from
either a previously exported XML history file or
SQL Assistant history file.
Cleanup history Opens a dialog to clean up SQL history records
based on selected criteria.
Clear Filter Removes the current filter from the display.

Filter Opens a dialog to filter the display.

Format History View Enables you to format the display. The platform
specific Font dialog displays to allow you to
select font, size, and color (on most platforms).
Sort multiple columns Opens a dialog for setting a multi-column sort.

Teradata Studio User Guide, Release 16.00 159


Chapter 5: Query Development
SQL History View
Context Menu Options:

Icons Option Description


Find Allows you to search the SQL History view for a
value.
Find Next Finds the next matching value in the history view.

Copy Row Copies the selected row(s). Rows are copied as text
and as HTML. The HTML display preserves the
column headers. The target to which you paste
determines whether text or HTML displays.
Copy Cells Copies the cell data to the clipboard.

Delete Row Deletes selected row(s) from the view and history
database.
Edit SQL Edits the SQL from a selected cell in the SQL
Statement column in an SQL Editor.
Edit Note Edits the note from a selected cell in the Note
column.
Reexecute statement Re-executes the SQL from the selected cell in the
SQL Statement column.

About SQL History Form


The SQL History view provides information about SQL/DDL executions on one or more databases in your
system. As you execute SQL/DDL statements from the SQL Editor or run functions from the Data Source
Explorer, an entry is added to the SQL History list.

Toolbar
The SQL History toolbar contains actions and menus that help you manage the data in the history data
grid.
Numbered Rows
The first column contains numbers assigned to each rows in the data grid. The numbers start with 1 and
increment for each data entry. The numbers do not indicate a special ordering or structure to the history
data. Use them as an easy way to refer to rows in the grid. To select an entire row, click the number for
the row. You can then right-click and select an action to perform on that row. For example, you might
select several rows and then right-click to select Find to search for specific data in those rows.
Column Header Row

160 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
SQL History View
The top row of the history grid contains the column headers for the categories of data collected during
each SQL/DDL execution.
SQL History Data Grid
The SQL History view uses a data grid format of rows and columns to display information for each
SQL/DDL execution. The grid displays each history entry in a single data row. Column headers in the
top row distinguish the types of data collected during each execution.

Toolbar for SQL History


The SQL History toolbar contains icons and menus to help you manage the SQL History view and display
of history records. Actions such as Delete Rows and Delete All History, in addition to removing records
from the view, delete the records in the SQL history database.

Actions

Click toolbar icons to perform tasks. You also can access actions from the menu drop-down ( ) at the
right-end of the toolbar.

Option Icon Label Description


Delete Row Deletes selected rows from the view and SQL history
database.
Filter Opens the History Filter dialog to select criteria for
filtering data in the view.
Clear Filter Resets filter by removing filter criteria and showing all
history entries in the view.
Export History Displays the Export History dialog to export SQL history
records to an XML file.
Import History Opens the Import History dialog to import SQL history
entries from an exported XML history file or SQL
Assistant history file.
Cleanup History Opens the Cleanup History dialog to clean up SQL
history records using the criteria you specify.
Sort Opens the Sort dialog to choose which columns you want
sorted.

Use the Minimize and Maximize icons at the far right to resize the SQL History view.

Teradata Studio User Guide, Release 16.00 161


Chapter 5: Query Development
SQL History View

Cleanup History
The Cleanup History dialog enables you to delete SQL History records based on selected criteria

Option Description
Delete SQL History using a criteria Enables you to delete records based on the following
criteria:
• Date deletes records from the SQL History view
when the Timestamp column value is less than
the selected date.
• Source deletes records from the SQL History view
when the Source column matches the entered
value
• SQL Statement deletes records from the SQL
History view when the SQL Statement column is
a super set of the entered value.
• Notes deletes records from the SQL History view
when the Notes column is a super set of the
entered value.
• User ID deletes records from the SQL History
view when the User ID column matches the
entered value.
• Queries that failed deletes records from the SQL
History view when the query execution failed.
• Rows with empty Notes deletes records from the
SQL History view when the Notes column value
is empty.

Delete duplicate queries in SQL History Deletes duplicate SQL query records from the SQL
History view.
Compact unused disk space allocated by SQL Releases allocated disk space not used by the SQL
History History view. After the command executes, you
must restart the application to make the disk space
available.

Import History
The Import History dialog enables you to import history view items from either a previously exported XML
history file or from an SQL Assistant MDB or XML file.

Option Description
Source Type Select either an XML file created using the Export
history option or an SQL Assistant history MDB file.
File Name Enter the name of the file from which to import the
history items.
Browse Select a folder and file name.

162 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Filtering with Data Filter
Note:
The import of an SQL Assistant MDB file is only available on the Microsoft Windows 32-bit platform. To
locate the SQL Assistant history MDB file, start SQL Assistant and click Tools > Options and select
Locating File Paths for the history file.

Export History
The Export History dialog enables you to save SQL History view items to an XML file. You can select to
export all or specific items from the view.

Option Description
File Name Displays the name of the XML file to which history
entries are saved.
Browse Opens a dialog to select the location and file name of
an XML file on the file system.
History Filter All Saves all history view items to an XML file.
History Filter Selection Saves only selected row items. You can select single
or multiple rows from the history view.

Filtering with Data Filter


Use the Data Filter feature to set filter rules that reduce the number of rows loaded into the Table Data
Editor.

1. From the Table Data Editor, click Data Filter icon.


2. In Filter, select a filter operator from the list and type a valid value or character string.
For example, if values in Column2 are type VARCHAR, and you filter to display only rows LIKE
product2, the Table Data grid refreshes to show all rows with the value product2 in the data string.
3. [Optional] If you want to clear all rules and set new filters, click Clear All.
4. Click OK to show filter results based on your filter rules.

Note:
The SYSUDTLIB database always shows in the filtered list.
5. When asked to confirm, click OK.

Note:
If you want to redo the filter results, click Revert in the toolbar, change the filter rules in the Data
Filter, and then click OK. You can repeat these steps as often as you like.

History Preferences
Exclude Options for History Database
Select one or more of these options to exclude in the Teradata SQL History database:

Teradata Studio User Guide, Release 16.00 163


Chapter 5: Query Development
Filtering with Data Filter

Option Description
Exclude Explain Statements Check this box to exclude EXPLAIN statements in the History
database.
Exclude Unsuccessful Queries Check this box to exclude unsuccessful queries from being
entered in the History database.

History Options

Option Description
Limit History View Rows Enter the maximum number of rows allowed to display in the
Teradata SQL History view.
Maximum Text Display Length Enter the maximum number of characters that can be
displayed in a row.
Derby Database Location Displays the location of the SQL history file. To change the
location, click Browse and navigate to the desired location.

History View Columns Settings


Use action buttons to select and move columns between the Columns Shown panel and the Removed
Columns panel.
Column Actions Description
Remove Removes the column you select from the Columns Shown
list.
Remove All Removes all columns shown in the Columns Shown list.
Add Moves a column from the Removed Columns list to the
Columns Shown list.
Add All Adds all columns in the Removed Columns list to the
Columns Shown list.
Up Moves a selected column one position up in the list.
Down Moves a selected column down one position in the list.

Column Options Description


Timestamp Date and time at which the query ended
Source Data source name
User ID User ID logged on
Destination TBW - in progress
Result Result message which is blank unless an error occurs. To see full message,
hover your mouse over a cell in the Result column.
Row Count • Teradata Database — number of rows matching the query submitted. If
you abort a query in progress or decline to continue after the output

164 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Database Objects Search

Column Options Description

limit is reached, Rows shows only how many rows matched the query
you submitted.
• Other databases — number of rows returned or changed. If you abort,
Rows shows only the number of rows returned.

Note User note attached to query


SQL Statement Query text
SQL Type Type of database accessed
Length Length of the query in characters
Statements Number of statements in the query
Statement Type List of statement types used in the query, such as, CREATE TABLE,
INSERT, SELECT.
Elapsed Time Total elapsed time for the query
DBMS Time Time spent within the database
Fetch Time Time taken to return the data
Parameters Number of parameters used in the query
Sequence Order in which the query was submitted to the database

Actions

Option Description
Apply Click to apply your changes.
Restore Defaults Click to return settings to default values.
OK Click to save your preference settings.

Database Objects Search

Find Object
Find Object

Find Object ( ) enables you to find a database object in the Data Source Explorer that matches a certain
text value. It begins the search from the point selected in the Data Source Explorer and returns the first
object whose name matches the text pattern.

Note:
The search is not case sensitive.

Teradata Studio User Guide, Release 16.00 165


Chapter 5: Query Development
Database Objects Search
Find Next

Find Next ( ) finds the next database object of the same object type that matches the text value, expands it,
and selects it in the Data Source Explorer.

Option Description
Search Value Specifies a value to search for. You can use the database 'LIKE' syntax to
provide a more expanded search. The 'LIKE' syntax includes a percent
sign ('%') and low line character ('_' ). The percent sign character
represents any string of zero or more arbitrary characters. The low line
character represents exactly one arbitrary character. For example, the
search value of 'emp%' finds the first object whose name starts with 'emp'.

Note:
You must use the backward slash character '\' as the escape character
when entering the special search characters, '\', '_', and '%', in your
search value. For example, 'emp\%' searches for the first object whose
name equals 'emp%'.

Object Type Selects the object type from the list of object types for which you want to
search.
Find Starts the search process.
Advanced Find Opens the Advanced Find dialog.
Reset Resets the Search Value to an empty field and the Object Type for the
selected location in the Data Source Explorer.

Finding Objects
You can search for database objects in the Data Source Explorer that have names that match a text string
you specify.
1. From the Data Source Explorer, right-click the database or user in which you want to search for an
object.
2. Click Teradata > Find Objects.
The Find Object dialog opens.
3. For Search Value Enter the exact name of the object you wish to find.
The search is case-insensitive.
If you know or wish to enter only a portion of the object name, click Advanced Find to open the
Advanced Find dialog where you can specify only a portion of the object name in your search criteria.
4. Use the Object Type list to specify the type of database object you are searching for.
If you wish to search more than one object type, click Advanced Find to open the Advanced Find
dialog where you can specify several types of objects to search.
5. Click Find.
• If you used the basic Find Object dialog box to search, the Data Source Explorer tree expands to
show you the first instance of an object it finds matching your criteria.
You can press F3 or right-click the Data Source Explorer tree and click Teradata > Find Next to
search for other objects that have the same name.

166 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Database Objects Search
• If you used the Advanced Find Objects dialog box to search, all results of the search are displayed in
a tab of the Object Viewer.

Advanced Find Objects


The Advanced Find Object ( ) feature enables you to find all database objects that match a certain text
pattern. It searches the referenced Connection Profile for objects names that match the text pattern. The
Advanced Find Objects feature uses the Teradata Dependency Browser to perform the search for each
object type selected in the dialog.

Option Description
List of Databases or If you opened Advanced Find Objects dialog from the Databases Folder, a
Connection Profiles list of databases for the given Connection Profile appears. If you opened the
available for the search Advanced Find Objects dialog from the Advanced Search button in the
simple Find Object dialog at the highest level in the Data Source Explorer,
the list of Connection Profiles appears.
You can use the arrows to move single selected items to or from the list of
objects to be searched. The double arrows allow you to move all available
objects to or from the list to be searched.
Search constraint The Find Objects feature uses the search constraint to build a search
pattern out of the search value and pass it on to the Teradata Dependency
Browser.

Note:
You must use the backward slash character '\' as the escape character
when entering the special search characters, '\', '_', and '%', in your search
pattern. The '_' (low line) character represents exactly one arbitrary
character. The '%' (percent sign) character represents any string of zero
or more arbitrary characters.

Types of search constraint are as follows:


Search Option Description
Starts with the characters Search value is appended with a '%'
character.
Ends with the characters Search value is prepended with a '%'
character.
Contains the characters '%' character is added to the begging
and end of the search value.
Anonymous Name Search Searches for anonymous or empty
name values. Anonymous names are
valid only for Primary Key, Foreign
Key, Check Constraint, and Index
names. All other object type name
options are disabled.

Teradata Studio User Guide, Release 16.00 167


Chapter 5: Query Development
Database Objects Search

Option Description

Search Option Description


Enter a valid SQL search pattern Use for a custom search pattern. The
search pattern follows the standard
database search pattern as used for
the Teradata 'LIKE' option pattern
match. For example, if you want to
search for all names that have
exactly one character after the word
'cust', the custom pattern would be
'cust_'. Or if you want to search all
names that match 'sales100%', then
the search pattern would be
'sales100\%'.

Note:
Use the '\' as the escape character
when entering the special search
characters, '\', '_', and '%', in the
search pattern.

Search Value The text value to search for.


Limit size of search result The limit to the size of the search result list. Valid values are between 1 and
to: 500.
Object Types Names you want to compare with the search value. This list is dependent on
where in the Data Source Explorer tree you invoke the Find Objects
dialog. For example, if you selected a Stored Procedures folder, the Stored
Procedure Name and Parameter Name object type options display.
Select All Selects all of the Object Type names presented.
Clear All Clears all of the Object Type names presented.

Advanced Find Results


The find results are displayed in the Find Results tab in the Object Viewer. The tab shows a list of the
objects found that match the search pattern in the Advanced Find Objects dialog. The list displays as a
table grouped by object types:
• Tables
• Macros
• Stored Procedures
• User Defined Functions
• User Defined Types
• Views
Within each object type category, it is further grouped by sub-element, such as:
• Columns

168 Teradata Studio User Guide, Release 16.00


Chapter 5: Query Development
Enabling Teradata Unicode Pass-Through
• Constraints
• Triggers for Tables
• Parameters for Macros and Stored Procedures
• Columns for Views

Find Results
The Find Results dialog provides a list of the objects found that matched the search pattern entered in the
Advanced Find Objects dialog. The list is displayed as a table grouped by object types and within each
object type category further grouped into details.

Enabling Teradata Unicode Pass-Through


Teradata Database 16.0 supports Unicode pass-through. Unicode pass-through enables you to store,
retrieve, and analyze emojis and other ideographs. You can utilize this feature by performing the following
steps.

1. Set the startup string for the user who will be connecting to the Teradata system:
a) In the Administration perspective, double-click Databases and select the user in the Object List
Viewer.
b) Right-click the row for the user and select Open Database/User.
The property form for the user is displayed.
c) In the General tab, ensure that the Startup String field reads: set session character set
unicode pass through on;
If it is not already set, modify the user properties to include the startup string.
2. Add the RUNSTARTUP JDBC property for the connection:
a) In the Teradata JDBC Connection Properties step of the Connection Profile wizard, enter the
credentials for the user and Teradata Database 16.0 system you are connecting to.
b) Click the Add button next to JDBC Connection Properties.
c) In the Add JDBC Property dialog, select the RUNSTARTUP JDBC property, select the property
value ON, and click OK.
The new property is listed in the JDBC Connection Properties display box.
3. Set the font that supports displaying symbols such as emojis:
a) From the Window menu, select Preferences.
b) Expand General > Appearance and click Colors and Fonts.
c) Select Text Font, and click the Edit button.
d) In the Font dialog, select the Segoe UI Symbol font and click OK.
e) Click OK to close the Preferences dialog.

Showing Table Row Counts


You can show the row count in one or more Teradata Database tables.
1. From the Administration perspective, select a database in the Navigator.
A list of available objects display in the Object List Viewer.

Teradata Studio User Guide, Release 16.00 169


Chapter 5: Query Development
Showing Table Row Counts
2. Click to highlight one or more tables in the Object List Viewer and do one of the following:

• From the toolbar, click .


• Right-click an object and select Row Count.
A list of the selected tables with their row count displays in the Row Count(s) property form.

170 Teradata Studio User Guide, Release 16.00


CHAPTER 6
Table Data Development

About the Table Data Editor


The Table Data Editor is an advanced editor for viewing and editing table data stored in a Teradata
Database or Teradata Aster Database. The editor can manage any size table including very large tables that
contain thousands of rows of data. You can also export table data to a file, such as Microsoft Excel, for
further review.
You can insert, delete, and update data in a table, and then filter to see the rows that have changed due to
your edits. You can also set filter rules on table columns to show only data of interest.
For ease of access and viewing, the Table Data Editor organizes data rows into pages that you select using
page controls in the toolbar. The default is 500 rows per page, but you can define a preferred page size at the
top of the editor.

Toolbar
The Table Data Editor toolbar contains navigation aids and action buttons that help you manage, filter,
and edit data in a database table.
Column Header Row
The top row of the Table Data Editor shows the labels and data types for the table columns.
Numbered Row Column
You can show or hide the first column by setting your preference in the Table Data Editor Preference
dialog. The column shows row numbers for the table you are editing.

Teradata Studio User Guide, Release 16.00 171


Chapter 6: Table Data Development
Table Data Editor
Table Data Grid
The Table Data Editor displays rows and columns of a database table in a spreadsheet grid format that
shows relationships of data in the table. To update and see the most current view of this data, click
Refresh in the toolbar.
Status Bar
This area displays error and system messages.

Table Data Editor


The Table Data Editor enables you to work directly with data stored in tables in a Teradata Database or
Teradata Aster Database. The editor interface is a table grid of columns and rows that displays the
corresponding data columns and rows of the selected database table.
You can right-click rows and columns to view the actions you can perform on data. You can resize column
and row widths by dragging line separators for column and row headers.

Toolbar
Use the toolbar to page to specific rows and to set the number of rows per page. You can also use the toolbar
to save, filter and sort, revert, export, and refresh data.

Table Data Grid


The Table Data Editor displays a grid of columns and rows. The grid rows and columns correspond to the
rows and columns in the table you selected from the Data Source Explorer tree. If the table you selected
contains a large number of rows, the editor automatically creates data pages which you can size using the
Page Size field in the toolbar. The default is 1000 rows per page.

Actions on Columns
Right-click a column header and select an option in the list.

Option Description
Hide columns Hides a column from the Table Data grid. The column in which you
right-clicked to select this option is the column that is hidden. To undo
the hide, select Show all columns.
Show all columns Causes any hidden columns to re-display in the Table Data Editor.
Auto resize column Changes the column width back to the auto-set width.
Find/Replace Opens the Find/Replace dialog in which you can enter keywords to
search data.
Show Values Opens the Show Values dialog in which you can specify filter rules
and show only rows that meet those rules. To undo a Show Values
filter result, select Reset Show Values.
Reset Show Values Resets rows to the order that existed prior to the Show Values filtering
of the column data.

172 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Editor
Actions on Rows
Right-click a row or cell and select an option from the list.

Option Description
Auto resize now Resizes rows back to the auto-set height.
Copy Copies one or more rows in the table for pasting to a data spreadsheet
file; for example, Microsoft Excel.
Insert Inserts a row in the table.
Revert Reverts the rows you select by undoing your changes to that row. You
are prompted to confirm the operation. Click OK to revert.
Delete Deletes the rows you select. Deleted rows are highlighted. To undo a
row deletion, select the row and next select Revert.
Select Rows for Export Selects rows for export by placing an Export icon in all selected
rows. The icon is aligned left in the first column of the row.
Clear Rows for Export Deselects rows for export. The change is indicated by the removal of
the Export icon in the first column of the row.
Clear All Selected Rows for Resets all rows previously selected for export. The Export icon is
Export the first column disappears.
Export Selected Rows Opens the Export Data dialog to export all data rows selected for
export. Rows selected for export are marked by an Export icon in
the first column.

Actions on Cells
Right-click a table cell and select an option from the list.

Option Description
Undo Undoes the last change.
Cut Removes the data from one or more selected table cells and retains for
pasting to a different cell.
Copy Copies data you want to paste to a data spreadsheet file; for example,
Microsoft Excel.
Paste Pastes data from the clipboard into selected table cell.
Delete Deletes the data in the cell.

Status Bar
The status bar at the bottom of the gird shows errors and Save status for the Table Data Editor.

Toolbar
The Table Data Editor toolbar contains navigation aids and action buttons that help you manage, find, and
edit the data in a database table.

Teradata Studio User Guide, Release 16.00 173


Chapter 6: Table Data Development
Table Data Editor

Table Navigation
Use the following features to navigate to specific rows in a large table.

Option Description
Row Type the row number to display at the top of the table data grid. Use
the drop-down menu to select a recent row number.
of Shows the number of data rows in the table. You cannot edit this field.
Page Size Select the number of rows to include per page from the drop-down list.
For example, if you select 1000, the first page begins at 1, and the
second page begins at 1001. The default page size is 500.

Actions
Click toolbar icons to perform tasks.

Option Icon Label Description


Select First Page Goes to the first page of table data pages.

Select Previous Page Displays next page.

Select Next Page Displays previous page.

Select Last Page Goes to last page of table data pages.

Save Commits data changes to the database. You can view the
SQL DDL statement in the SQL Preview view before you
click the Save icon.
Filter by Edits Displays the Show Edits dialog.

SQL Preview Displays the SQL Preview dialog to view generated SQL.

Revert Reverts values back to pre-edit states.

Data Filter/Sort Displays the Data Filter dialog to specify filter and sort
data rules.
Export All Displays the Export Data Wizard which exports all data.

Refresh Refreshes table data list from data in the database.

174 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Editor

About Editing Large Data and Objects


The Table Data Editor provides editing capabilities for large data and large object storage in a database.
You can edit:
• Binary Large Object (BLOB) - Contains raw binary data stored as a single object. BLOBs are used to
store images, video clips, and word documents. See Editing Binary Large Object Data.
• Character Large Object (CLOB) - Contains only plain text, same as VARCHAR data type, and is used
to store simple text, HTML, or XML documents. CLOBs are considered a subset of BLOBs since
character data is a sequence of bytes and can be stored in BINARY fields as well as CHAR fields. See
Editing Character Large Object Data.
• Large Binary Data - Contains raw binary data stored as VARBYTE data type. See Editing Large Binary
Data.
• Large Text Data - Contains character data stored as VARCHAR data type. See Editing Large Text Data.
• XML Data Type - Contains data in the Extensible Markup Language (XML) format. See Editing XML
Data.

About Paging Large Tables


The toolbar in the Table Data Editor contains several features that enable you to specify how many rows are
included in a page, and to move forward and backward through pages to locate data.

Use the Page Size field to specify the number of data rows you want included in a page.
To review data in a table, use the page arrow keys to move to the beginning or end of the table, or
incrementally forward or backward one page at a time.

Data Filter
The Data Filter dialog enables you to define data filters for the Table Data Editor. Use filtering to reduce
the number of rows loaded into the Table Data Editor and to display only data of interest. You can
determine which data displays by:
• Sorting column order
• Filtering on data values within columns

Filter Tab
Move column names from the Table Column list to the Sort Column list to indicate on which columns to
sort to display data in the Table Data grid.

Option Description
Column Names Lists names of columns in table.
Types Lists data type for each column in Column Names.
Select By Select a filter operator from the list and type a valid value or character
string. For example, if values in Column1 are type INTEGER, and you

Teradata Studio User Guide, Release 16.00 175


Chapter 6: Table Data Development
Table Data Editor

Option Description
filter to display only rows greater than (>) 5999, the Table Data grid
refreshes to show all rows with the value 6000 or above.

Sort Tab
Use fields and radio buttons in this section to indicate how you want columns sorted.

Option Description
Table Columns Lists all columns by name in the table.
Ascending Orders the Table Columns list from the smallest or lowest to the
largest or higher value. For example, A to Z or 1 to 100.
Descending Orders the Table Columns list from the largest or higher value to the
smallest or lowest value. For example, Z to A or 100 to 1.
Sort Columns Lists one or more columns in the order on which to sort.
Up Select a column in the Sort Columns list and click Up to move it up in
the list order.
Down Select a column in the Sort Columns list and click Up to move it up in
the list order.

Actions
Use the action buttons at the bottom of the dialog to clear or save your settings.

Option Description
Clear All Click to revert all selections in the Select By column to the default
None.
OK Click to save your Filter and Sort settings.

Opening the Table Data Editor


The Table Data Editor gives you the ability to manage data stored in Teradata databases. Begin by using the
Data Source Explorer view to find the table object you want to review or modify.
1. Open the Data Source Explorer view (Window > Show View > Data Source Explorer).
2. Navigate to the table you want to review or modify.
3. Right-click the table object and select Data > Edit Data.
The Table Data Editor opens in the right pane and displays the data in the table you selected.
You can also open the Table Data Editor from the Data Lab view.
1. Open the Data Lab view (Window > Show View > Data Lab View).
2. Navigate to the table you want to review or modify.
3. Right-click the table object and select Edit Data.

176 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Editor

Table Data Editor Preferences


Set preferences to determine how the Table Data Editor displays. You can set these features:
• Show or hide numbered row column header
• Background color for alternate table rows
• Highlighted row color for inserted, updated, and deleted data
• Thresholds for filter and transaction rows

Color Options
To control color, choose from these options:

Option Description
Display alternate Result Set Select the check box to enable an alternate row background color, and
rows in color then select the color. Click the color box to see color options.
Insert Selection Color Click the color box to select the background color for inserted data.
Update Selection Color Click the color box to select the background color for updated data.
Delete Selection Color Click the color box to select the background color for deleted data.

Editor Options
To set edit preferences, choose from these options:

Option Description
Show Row Numbers Select the check box to show numbered rows in the first column of the
data grid.
Display Filter Dialog Threshold Enter the number of table rows above which the Table Data Editor
(rows) presents the Data Filter dialog. Be sure to specify filters in the Table
Data Editor to reduce the number of data rows that display. The
default is 500000.
Transaction Commit Size (rows) Enter the number of data rows to batch in a single COMMIT
transaction. This number is the threshold at which the batch UPDATE
operation occurs. For example, if you set the threshold at 1000, the
operation batches 1000 data row updates in a single COMMIT
transaction. The default is 500.

Copy and Paste Options


To set copy and paste preferences, choose from these options:

Option Description
Copy Column Names when Select the check box to include column header labels when copying
Copying Rows data to a file.
Column Delimiter Select from the list the type of delimiter to use to separate data when
copying or pasting from the editor to a file, such as Microsoft EXCEL
or Notepad. Supported delimiters are: Tab (default), Comma,
Semicolon, and Space.

Teradata Studio User Guide, Release 16.00 177


Chapter 6: Table Data Development
Table Data Editing
Actions
Apply, restore, or save your settings by choosing from these options:

Option Description
Apply Click to apply your changes. You can preview results in the Table
Data Editor.
Restore Defaults Click to return to default values.
OK Click to save your preference settings.

Setting Table Data Editor Preferences


You can set preferences that determine the appearance and functional behavior of the Table Data Editor.
You can accept the defaults or select new settings.
1. Select Window > Preferences in the main menu.
2. Expand Teradata Datatools Preferences and select Table Data Editor Preferences.
3. Make any desired changes to the Table Data Editor Preferences.
4. Click Apply to apply your changes.
You can preview results in the Table Data Editor before you click OK.
5. After previewing, if you want to return to default values, click Restore Defaults.
6. Click OK to save your preference settings.

Table Data Editing

About Editing Table Data


The Table Data Editor enables you to edit data stored in tables in a Teradata or Aster database. The editor
supports very large tables and provides several additional editors for large data objects such as Character
Large Objects (CLOBs) and Binary Large Objects (BLOBs). It also supports an XML Data Type Editor for
editing XML data. Rows of data can be grouped into pages that allow you to quickly locate table rows.
Advanced filter and sort functions in the Data Filter help you to easily find data of interest.
You can edit table data either directly in the Table Data Editor or you can export data to a Microsoft Excel
spreadsheet or text file to change the data and then import it back into the table using the Load Data
Wizard. Use the toolbar functions at the top of the editor to export data.
Editing data in the Table Data Editor is as simple as editing data in a spreadsheet editor. Insertion and
deletion functions are similar, as well as keyboard and cursor actions.

Editing Table Data


The Table Data Editor enables you to update data in a database table by:
• Inserting table data.
• Deleting table data.

178 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Editing
• Reverting table data.
In addition, it also provides several editors for large data tables. Editors include:
• CLOB Editor
• BLOB Editor
• Large Binary Editor
• Large Text Editor
• XML Data Type Editor

Inserting Table Data


You can insert rows in a table.
1. Right-click on a row or in the Table Data grid.
2. Select Insert.
3. Enter data in the new row at the bottom of the table.
4. Click in the toolbar to save your changes.

You can undo an insertion by clicking in the toolbar. or right-clicking the row or in the Table Grid and
selecting Revert. If you want to revert more than one row at the same time, select multiple rows and click
Revert.

Displaying Column Data by Value


You can specify to show values by columns.
1. Right-click in the column header of the column in which you want to show specific values.
2. Select Show Values.
3. In the Show Values dialog, select from one of the two steps below as the options are different based on
the data type of values in the selected column.
4. To show values for DECIMAL, FLOAT, INTEGER, SMALLINT, BYTEINT, BIGINT, TIME,
TIMESTAMP, or DATE data types, select from these options:

Option Description
Show Values Equal Type a numeric value to match against column data values that are equal to
with the value you enter.
Show Values Greater Type a numeric value to match against column data values that are greater
than than the value you enter.
Show Values Less than Type a numeric value to match against column data values that are less than
the value you enter.
5. To show values for the VARCHAR data type, select from these options:

Teradata Studio User Guide, Release 16.00 179


Chapter 6: Table Data Development
Table Data Editing
Option Description
Show Values that Type a value to match against the initial characters of a data value in the selected
Start with column. The field supports alpha-numeric characters. Do not use special
characters or wildcards.
Show Values that Type a value to match against the end characters of a data value in the selected
End with column. The field supports alpha-numeric characters. Do not use special
characters or wildcards.
Show Value that Type the value you want to match against characters contained in data values in
Contains the selected column. The field supports alpha-numeric characters. Do not use
special characters or wildcards.
6. Click OK.

Deleting Table Rows


You can delete entire rows of data in a table. For information about deleting data in cells, see Deleting Data
from Cells.
1. Select a table row.
The row background color changes when you select it.
2. Right-click and select Delete.
The row is marked for deletion from the table.
3. Click in the toolbar to save your changes.

You can undo a deletion by clicking in the toolbar or right-clicking the row and selecting Revert.

Deleting Data from Cells


You can right-click a table cell to display the Delete option. The Delete function deletes only data in a cell,
and does not delete the selected table cell.
1. Select a table cell. The cell background color changes when you select it.
2. Right-click and select Delete.
3. Click in the toolbar to save your changes.

Reverting Edits
You can reset data to pre-edited values by clicking the Revert icon ( ) in the toolbar. When you revert
data, all unsaved changes are discarded, and any edited data is reset to its last saved value.

1. Click the Revert icon ( ) in the toolbar.


2. Confirm that you want to revert the contents of your data sheet by clicking OK.
The Table Data Editor refreshes and shows the data reset to pre-edited values.

180 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Editing

Finding and Replacing Data


You can find specific data values in a table column and replace it with a different value. You cannot replace
values across columns in a table.
1. Right-click in the column header of the column that contains the data you want to find and replace.
2. Select Find/Replace.
3. In Find, type the value you want to find.
4. In Replace With, type the value you want to replace the found value with.
5. [Optional] Under Options, select these check boxes:

Option Description
Case Sensitive Select to find only case-exact matches.
Wrap Search Select this option if you want the search to return to the top of the column after it
reaches the bottom. If you do not select this option and begin your search in the middle
of a column, the search only does an incremental Find for half of the column and
stops.
6. Click to select an action:

Option Description
Find Click to perform an incremental find of the value you entered in Find above.
Replace Click to replace an incremental Find value with the value you entered in Replace above.
Replace All Click to replace all Find values at the same time.
7. Click Close to return to the Table Data Editor.

Find Replace
The Find Replace dialog lets you find specific data values in a table column and replace them with a
different value. You cannot replace values across columns in a table. You can:
• Search for specific data values in tables.
• Replace target values with new values.
• Replace all values at the same time or incrementally one by one.

Find/Replace Values
You specify a data value to find and which value you want to replace it by completing these fields:

Option Description
Find Type the data value you want to find. The data type must be consistent
with the data type of the selected column. To perform only a Find
operation, click Find at the bottom of the dialog. The Find operation
looks for the value in the data column in which you opened the Find/
Replace dialog.
Replace Type a data value to replace the value in Find. The data type must be
consistent with the column data type. To perform the Find/Replace
operation, click Replace at the bottom of the dialog.

Teradata Studio User Guide, Release 16.00 181


Chapter 6: Table Data Development
Table Data Editing
Find/Replace Criteria
As an option, you can specify additional criteria for a Find/Replace operation by selecting the following
check boxes:

Option Description
Case Sensitive Select to find only case-exact matches.
Wrap Search Select this option if you want the search to return to the top of the
column after it reaches the bottom. If you do not select this option and
begin your search in the middle of a column, the search only does an
incremental Find for half of the column and stops.

Actions
Select an action from these options to perform Find and Replace operations.

Option Description
Find Click to perform an incremental find of the value you entered in Find
above.
Replace Click to replace an incremental Find value with the value you entered
in Replace above.
Replace All Click to replace all Find values at the same time.
Close Click to return to the Table Data Editor.

Selecting to Filter by Edits


After you modify data in a table, you can select to view only the edited data rows. Filters are available for
updated, deleted, or inserted data. This feature is useful if you've made multiple changes in a large table and
want to review your changes before updating them in the database. It can also be used to group changes for
export to a file, either as a record or for later review.

1. With an edited table open in the Table Data grid, click the Filter by Edits icon in the toolbar.
The Show Edits dialog opens.
2. Select which type of edit to display by checking one or more of these options:
a) Select the Inserts check box to display any rows with newly inserted data in the table.
b) Select the Updates check box to display rows in which data has been added, edited, revised, or
deleted.
c) Select the Deletes check box to display rows removed from the table.
3. Click OK.
The Table Data Editor refreshes to show only table rows that match the filter options you selected.

Viewing SQL Preview for Data Updates


After you make an edit, you can preview the generated SQL DDL statements. The SQL DDL statement
includes updates and other changes that are submitted to the database when you save your changes.
1. Make one or more edits in the Table Data Editor.

182 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing
2. Click the SQL Preview icon in the toolbar.
3. Review the generated SQL in the SQL Preview text box.
4. If you find an incorrect data update, return to the Table Data Editor and make further edits to correct it.
5. Click Close to return to the Table Data Editor view.

Large Data and Objects Editing

About the Blob Editor


You can use the Table Data Editor to review and edit database tables that contain Binary Large Objects
(BLOBs). A BLOB is a collection of binary data stored as a single entity in a Database Management System
(DBMS). BLOBs are typically images, audio, or other multimedia objects, though sometimes binary
executable code is stored as a BLOB. You must edit BLOBs in the Blob Editor.

Source of Imported Data


If the data in the object is imported, the source file for that data displays in the File field.
Actions on Object
You can import, export, or clear the binary data in BLOBs. These functions are selected by clicking the
action buttons to the left of the editor workarea.
Editor Workarea
The editor workarea displays the current data for the object you selected to edit. You can insert, delete,
and modify data displayed in this area. You can also import from or export to files such as a text file. To
remove all data displayed in the editor workarea, click Clear.

Note:
You can view, import, and export data larger than 64k, but you cannot edit the data. Imported data
that is larger than 64k is identified by its filename in the editor.

Slidebars
The data in an object is often more than can be displayed within the editing area. Use the slidebars on
each side of the workarea to scroll through data.

Blob Editor
The BLOB Editor displays the binary data contained in the selected Binary Large Object (BLOB) stored in a
database.
You can edit the data in the BLOB by:
• Inserting binary data
• Deleting binary data
• Clearing the binary data in the object
• Importing binary data from a file
• Exporting the binary data in the object

Teradata Studio User Guide, Release 16.00 183


Chapter 6: Table Data Development
Large Data and Objects Editing
A BLOB data object can be represented in one of three ways:
• BLOB handle - Handle to the BLOB data in the database.
• Snippet of data - Text snippet you edit or insert in cell.
• Filename - For data objects over 64k, name of file that contains the data. You can edit or insert data in
this file. BLOB data larger than 64k cannot be edited in the Blob Editor.

Edit Blob Value


Use the Blob Editor to modify the binary data in the Binary Large Object (BLOB) that you selected from a
BLOB table.

Option Description
File If data is imported, shows the name of the import source file.
Editor Workarea Displays the binary data in the selected object.

Actions
Use the action buttons to the right of the editor to import, export, or clear binary data.

Option Description
Import Click to import binary data from a file.
Export Click to export the binary data displayed in the editor to a file, such as
a binary data file.
Clear Click to remove all data displayed in the editor workarea.
OK Click to save the data to the object.

Opening the Blob Editor


You open the Blob Editor from the Table Data Editor by selecting the row that contains the Binary Large
Object (BLOB) in the table.
A BLOB data object can be represented in one of three ways:
• BLOB handle - Handle to the BLOB data in the database.
• Snippet of data - Text snippet you edit or insert in cell.
• Filename - For data objects over 64k, name of file that contains the data. You can edit or insert data in
this file. BLOB data larger than 64k cannot be edited in the Blob Editor.
To open the Blob Editor:
1. Select a table that contains a BLOB object and open it in the Table Data Editor.
See Opening the Table Data Editor. The table name displays in the tab at the top of the editor. You can
open several tables in the editor and move between them by clicking these tabs.
2. Select the BLOB to edit from the Binary Large Objects column.
Single objects are separated in rows.
3. Click the ellipses ( ) at the right end of the row to open the Blob Editor.
See About the Blob Editor.

184 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing

Editing BLOB Data


You can edit a Binary Large Object (BLOB) by inserting, deleting, and changing the binary data contained in
the object.
1. Select a BLOB table in your database.
2. Right-click the table and select Teradata > Edit Data.
3. The table objects display in the Binary Large Object column in the Table Data Editor.
4. Locate the BLOB you want to edit and select it.
The table row highlights, and an ellipses ( ) displays at the right end of the row.
5. Click the ellipses ( ) to open the Blob Editor.
6. Review and edit the data in the object.
7. Click OK to save your changes to the object.
Also you can export the data to a binary data file to review and edit the data, and then import that data back
to the Blob Editor.

About the Clob Editor


You can use the Table Data Editor to review and edit database tables that contain Character Large Objects
(CLOBs). A CLOB is a collection of character data stored as a single entity in a Database Management
System (DBMS).

Teradata Studio User Guide, Release 16.00 185


Chapter 6: Table Data Development
Large Data and Objects Editing

Source of Imported Data


If the data in the object is imported, the source file for that data displays in the File field.
Actions on Object
You can import, export, or clear the binary data in CLOBs. These functions are selected by clicking the
action buttons to the left of the Edit workarea.
Editor Workarea
The editor workarea displays the current data in the selected object for edit. You can insert, delete, and
modify data displayed in this area. You can import from or export to files, such as a Microsoft Word file
or text file. You can also remove all data by clicking Clear.

Note:
CLOB data larger than 64k can be viewed, exported, and imported, but not edited in the Clob Editor.
To edit files larger than 64k, export to a text editor.

Slidebars
The data in an object is often more than can be displayed within the editing area. Use the slidebars on
each side of the Edit workarea to scroll through data.

186 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing
Encoding Standard
The Encoding fields shows the encoding standard used for the data in the editor workarea. Use the
drop-down menu to select a different standard.

Clob Editor
The Clob Editor displays the character data contained in the selected Character Large Object (CLOB) stored
in a database.
You can edit the data in the CLOB by:
• Inserting character data
• Deleting character data
• Clearing the character data in the object
• Importing character data from a file
• Exporting the character data in the object
A CLOB data object can be represented in one of three ways:
• CLOB handle - Handle to the CLOB data in the database.
• Snippet of data - Text snippet you edit or insert in cell.
• Filename - For data objects over 64k, name of file that contains the data. You can edit or insert data in
this file. CLOB data larger than 64k cannot be edited in the Clob Editor.

Edit Clob Value


Use the Clob Editor to modify the character data in the Character Large Object (CLOB) that you selected
from a CLOB table.

Option Description
File If data is imported, shows the name of the import source file.
Editor Workarea Displays the character data in the selected object.

Actions
Use the action buttons to the right of the editor to import, export, or clear character data.

Option Description
Import Click to import character data from a file.
Export Click to export the character data displayed in the editor to a file, such
as a Microsoft Word or text file.
Clear Click to remove all data displayed in the editor workarea.
OK Click to save the data to the object.

Opening the Clob Editor


You open the Clob Editor from the Table Data Editor by selecting the row that contains the Character
Large Object (CLOB) in the table. A CLOB data object can be represented in one of three ways:
• CLOB handle - Handle to the CLOB data in the database.

Teradata Studio User Guide, Release 16.00 187


Chapter 6: Table Data Development
Large Data and Objects Editing
• Snippet of data - Text snippet you edit or insert in cell.
• Filename - For data objects over 64k, name of file that contains the data. You can edit or insert data in
this file. CLOB data larger than 64k cannot be edited in the Clob Editor.
To open the Clob Editor
1. Open a table that contains a CLOB object to edit in the Table Data Editor.
The table name displays in the tab at the top of the editor. You can open several tables in the editor and
move between them by clicking these tabs. See Opening the Table Data Editor for more information.
2. Select the CLOB to edit from the Character Large Objects column.
Single objects are separated by rows.
3. Click the ellipses ( ) at the right end of the row to open the Clob Editor.
See About the Clob Editor.

Editing CLOB Data


You can edit a Character Large Object (CLOB) by inserting, deleting, and changing the character data
contained in the object.
1. Select a CLOB table in your database.
2. Right-click the table and select Teradata > Edit Data.
3. The table objects display in the Character Large Object column in the Table Data Editor.
4. Locate the CLOB you want to edit and select it.
The table row highlights, and an ellipses ( ) displays at the right end of the row.
5. Click the ellipses ( ) to open the Clob Editor.
6. Review and edit the data in the object.
7. Click OK to save your changes to the object.
Also you can export the data to a Microsoft Word or text file to review and edit the data, and then import
that data back to the Clob Editor.

About the Large Binary Editor


You open the Large Binary Editor from the Table Data Editor by selecting the row that contains large
binary data in a table. The Large Binary Editor provides a large workarea where you can review and modify
data, and export and import data.

188 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing

Actions on Object
You can import, export, or clear the binary data in the editor. These functions are selected by clicking
the action buttons to the left of the editor workarea.
Editor Workarea
The editor workarea displays the data you selected for edit. You can insert, delete, and modify data
displayed in this area. You can import from or export to files, such as a Microsoft Excel file. You can also
remove all data by clicking Clear.
Slidebars
Large binary data is frequently too large to display without scrolling the editing area. Use the slidebars
on each side of the editor workarea to scroll right-left or up-down through data.

Opening the Large Binary Editor


You open the Large Binary Editor from the Table Data Editor by selecting the row that contains large
binary data.
1. Open a table that contains rows of large binary data to edit in the Table Data Editor.
The tab shows the name of the large binary data table you opened in the Table Data Editor. You can
open several tables in the editor and move between them by clicking these tabs. See Opening the Table
Data Editor for more information.
2. Select a row to edit from the VARBYTE column by clicking the row.

Teradata Studio User Guide, Release 16.00 189


Chapter 6: Table Data Development
Large Data and Objects Editing
Data is stored as single objects in separate rows.
3. Click the ellipses ( ) at the right end of the row to open the Large Binary Editor.
See About the Large Binary Editor.

Large Binary Editor


The Large Binary Editor displays the binary data you selected from a table you are editing in Table Data
Editor.
You can edit the data by:
• Inserting binary data
• Deleting binary data
• Clearing the binary data in the editor
• Importing binary data from a file
• Exporting the binary data to a file

Edit Binary Data


Use the Large Binary Editor to modify the binary data in a table. The editor provides a large workarea that
displays the binary data you selected from the table. Edit your binary data in this workarea.

Actions
Use the action buttons to the right of the editor to import, export, or clear binary data.

Option Description
Import Click to import binary data from a file.
Export Click to export the binary data displayed in the editor to a file, such as
a text file.
Clear Click to remove all data displayed in the editor workarea.
OK Click to save the data.

190 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing
Editing Large Binary Data
You can use the Table Data Editor to display and edit tables that contain large binary data. A large binary
data table contains raw binary data stored as VARBYTE data type.
1. Select a table that contains large rows of raw binary data (VARBYTE) in your database.
2. Right-click the table and select Teradata > Edit Data.
3. The table data displays in the VARBYTE column in the Table Data Editor.
4. Locate the row you want to edit and select it. The table row highlights, and an ellipses ( ) displays at the
right end of the row.
5. Click the ellipses ( ) to open the Large Text Editor.
6. Review and edit the data displayed in the editor.
You can edit directly in the editor or you can export the data to a Microsoft Excel or text file to review
and edit the data, and then import that data back to the Large Text Editor.
7. Click OK to save your changes to the object.

About the Large Text Editor


You can use the Table Data Editor to display and edit tables that contain character data. A large text data
table contains large amounts of character data stored as VARCHAR data type and must be edited in the
Large Text Editor.

Teradata Studio User Guide, Release 16.00 191


Chapter 6: Table Data Development
Large Data and Objects Editing

Actions on All Data in Editor


You can import, export, or clear the data displayed. These functions are selected by clicking the action
buttons to the left of the editor workarea.
Editor Workarea
The editor workarea displays the large text data you selected to edit. You can insert, delete, and modify
data displayed in this area. You can import from or export to files, such as a Microsoft Word file. You
can also remove all data by clicking Clear.
Slidebars
The data in an object is often more than can be displayed within the editing area. Use the slidebars on
each side of the Edit workarea to scroll through data.
Encoding Standard
The Encoding fields shows you the encoding standard used for the the data in the editor workarea. Use
the drop-down menu to select a different standard.

192 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing
Large Text Editor
The Large Text Editor enables you to edit VARCHAR or CHAR data stored in a large text data table.
You can edit the data by:
• Inserting character data
• Deleting character data
• Clearing the character data in the editor
• Importing character data from a file
• Exporting the character data to a file

Edit Text Value


Use the Large Text Editor to modify the character data in a table. The data you select displays in the
workarea in the center of the editor. You can also export the data to a file where you can review and edit the
data, then import it back into the editor.

Actions
Use the action buttons to the right of the editor to import, export, or clear character data.

Option Description
Import Click to import character data from a file.
Export Click to export the character data displayed in the editor to a file, such
as a Microsoft Word or text file.
Clear Click to remove all data displayed in the editor workarea.
OK Click to save the data to the object.

Opening the Large Text Editor


You open the Large Text Editor from the Table Data Editor by selecting the row that contains large text
(VARCHAR) data.
1. Select a table that contains rows of large text data and open it in the Table Data Editor.
See Opening the Table Data Editor. The name of the large text data table displays in the tab at the top of
the Table Data Editor. You can open several tables in the editor and move between them by clicking
these tabs.
2. Locate the data you want to edit in the VARCHAR column and click the row that contains the data.
Data is stored as single objects in separate rows.
3. Click the ellipses ( ) at the right end of the row to open the Large Text Editor.
See About the Large Text Editor. The data you selected displays in the Large Text Editor.

Teradata Studio User Guide, Release 16.00 193


Chapter 6: Table Data Development
Large Data and Objects Editing

Editing Large Text Data


You can use the Table Data Editor to display and edit tables that contain character data. A large text data
table contains large amounts of character data stored as VARCHAR data type. The Table Data Editor
provides a special Large Text Editor for this type of data.
1. Select a table that contains large rows of character data (VARCHAR) in your database.
Data is stored as single objects in separate rows.
2. Right-click the table and select Teradata > Edit Data.
You can open several tables in the editor in this way and move between them by clicking the tabs at the
top of the editor.
3. The large text data displays in the VARCHAR column in the Table Data Editor.
4. Locate the row you want to edit and select it.
The table row highlights, and an ellipses ( ) displays at the right end of the row.
5. Click the ellipses ( ) to open the Large Text Editor.
6. Review and edit the data displayed in the editor.
You can edit directly in the editor or you can export the VARCHAR or CHAR data to a Microsoft Word
or text file to review and edit the data, and then import that data back to the Large Text Editor.
7. Click OK to save your changes to the object.

About the XML Data Type Editor


You can use the Table Data Editor to access Extensible Markup Language (XML) data type objects stored in
the connected database. To edit the data, you must edit the XML data type object in the XML Editor.

194 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Large Data and Objects Editing

Source of Imported Data


If the data in the object is imported, the source file for that data displays in the File field.
Actions on Object
You can import, export, or clear the data in XML data type objects. These functions are selected by
clicking the action buttons to the left of the Edit workarea.
Editor Workarea
The editor workarea displays the current data in the selected object for edit. You can insert, delete, and
modify data displayed in this area. You can import from or export to files, such as a text file. You can
also remove all data by clicking Clear.
Slidebars
The data in an object is often more than can be displayed within the editing area. Use the slidebars on
each side of the workarea to scroll through data.
Encoding Standard
The Encoding field shows the encoding standard used for the data in the editor workarea. Use the drop-
down menu to select a different standard.

Teradata Studio User Guide, Release 16.00 195


Chapter 6: Table Data Development
Large Data and Objects Editing
XML Editor
The XML Editor displays the Extensible Markup Language (XML) data contained in the selected XML data
type object stored in a database. An XML data type object is represented by the handle to the XML data
stored in the database.
You can edit the data in the XML object by:
• Inserting XML data
• Clearing the XML data in the object
• Importing XML data from a file
• Exporting the XML data in the object to a file

Edit XML
Use the XML Editor to review and modify data in an XML data type object. that you selected using the
Table Data Editor.

Option Description
File If data is imported, shows the name of the import source file.
Editor Workarea Displays the data in the selected XML data type object.

Actions
Use the action buttons to the right of the editor to import, export, or clear XML data.

Option Description
Import Click to import XML data from a file.
Export Click to export the XML data displayed in the editor to a file, such as a
text file.
Clear Click to remove all data displayed in the editor workarea.
OK Click to save your data changes to the object.

Opening the XML Editor


You open the XML Editor from the Table Data Editor by selecting an XML data type object stored in a
database table. An XML data type object is represented by the handle to the XML data in the database.
1. In the Table Data Editor, open a table that contains the XML data type object you want to edit.
The table name displays in the tab at the top of the editor. You can open several tables in the editor and
move between them by clicking these tabs. See Opening the Table Data Editor for more information.
2. Select the XML data type object to edit from the XML column.
Single objects are separated by rows.
3. Click the ellipses ( ) at the right end of the row to open the XML Editor.
See About the XML Editor.

196 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Filtering

Editing XML Data


You can use the Table Data Editor to display and edit database tables that contain XML data types. The
Table Data Editor provides a special XML Editor for this type of data.
1. Select a table in your database that contains the XML data type.
XML data type objects are stored as single objects in separate rows within the table.
2. Right-click the table and select Teradata > Edit Data.
You can open several tables in the editor in this way and move between them by clicking the tabs at the
top of the editor.
3. Review the table.
Any XML data displays in the XML column of the table and is visible in the Table Data Editor.
4. Locate the object you want to edit and select the row for that object.
An XML data type object is represented by the handle to the stored XML data. When you select the
object, the row highlights, and an ellipses ( ) displays at the right end of the row.
5. Click the ellipses ( ) to open the XML Editor.
6. Review and edit the data displayed in the editor.
You can edit directly in the editor or you can export the XML data to a text file to review and edit the
data, and then import that data back to the XML Editor.
7. In Encoding, select the encoding standard to use from the list.
8. Click OK to save your changes.

Table Data Filtering

About Filtering Table Data


The Table Data Editor provides several ways to filter table data.
You can filter data:
• To view only data of interest in columns. See Displaying Column Data by Value.
• To view only rows in which you have inserted, updated, or deleted data. See Selecting to Filter by Edits.
• To view data of interest using Data Filter rules. See Filtering with Data Filter.

Teradata Studio User Guide, Release 16.00 197


Chapter 6: Table Data Development
Table Data Filtering

About the Data Filter


The Data Filter dialog enables you to set filter rules to define which data is loaded and displayed in the
Table Data Editor. Each time you use this dialog, the data is reloaded into the editor based on the rules you
specify. To access the Data Filter dialog, click the Filter icon in the Table Data Editor toolbar.
The dialog consists of two tabs described below.

Filter Tab
The Filter tab lists all columns in the table and enables you to set filter rules for each column. It is comprised
of the following elements:

198 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Table Data Filtering
List of Columns in Table
The Filter list displays all table columns. Select filter options in Select By to view in the Table Data
Editor only data in which you are interested.
Data Type of Column
The Types list shows the column data type.
Selection of Filter Rule
In Select By, create a filter rule to apply to the column. Use the list to select a filter operator and enter a
value. For example, you could specify a rule that filters column data for only values greater than 1000.
Filter operators are based on column data type.
Filter Rules by Column
The Data Filter dialog provides the ability to define specific filter rules for each column in the selected
table. Use this area to define, review, and refine your Table Data Editor view for specific tables. The
default is None.
Clear All Button
Click Clear All to reset filter rules for all columns to None.

Sort Tab
Use the Sort tab to specify column row order for the Sort operation. For example, if you move Column3 to
the Sort Columns list and position it as the first column in the list, the Sort operation sorts all column rows
based on the row order in Column3. The tab consists of the following elements:

Teradata Studio User Guide, Release 16.00 199


Chapter 6: Table Data Development
Table Data Filtering

200 Teradata Studio User Guide, Release 16.00


Chapter 6: Table Data Development
Exporting Table Data
List of All Columns in Table
A list of all table columns displays in the Table Columns selection box. You can order the list in either
ascending or descending order by table name.
Ordered List of Columns for Sort
Move columns from Table Columns to Sort Columns to specify the column sort order. Use Up and
Down to change column order.
Choice Buttons: Order Table Column List
Choose how you want the column list ordered:
• Ascending - Orders the Table Columns list from the smallest or lowest to the largest or higher value.
For example, A to Z or 1 to 100. This is the default.
• Descending - Orders the Table Columns list from the largest or higher value to the smallest or
lowest value. For example, Z to A or 100 to 1.

Action Buttons: Order Columns for Sorting


Move columns up or down in the list. The sort operation uses the column order to determine sorting
rules. The primary sort is based on the first column in the list.

Exporting Table Data


You can export data to a file, such as a Microsoft Excel spreadsheet or a text file. The Table Data Editor uses
the Export Data Wizard to export data from tables. You can select data to export all data in the table or only
data in specific rows to export.

Exporting All Data


The Export All feature exports all data in the table.

1. In the toolbar, click Export All.


2. Follow steps for Export Data Wizard below.

Exporting Data in Rows


The Export feature exports only data in the table rows you select.
1. Select the data rows you want to export. You can select multiple rows using the Ctrl key.
2. Right-click and select Select Rows for Export. The rows are marked for export.
3. Right-click and select Export Selected Rows.
4. Follow steps for the Export Data Wizard below.

Exporting with Teradata Export Wizard

1. The Export Data dialog opens. Follow these steps for both Export All and Export tasks.
2. In Output File, type the path name of the file to which you want the data exported. You can also click
Browse to locate and save the file.
3. In File Type, select from the list the type of the output file in the previous step. For example, you can
select a delimited text file, Excel, or Excel (97-2003) file.
4. Select Column Labels in First Row to specify that you want column labels to be output in the first row
of the file.

Teradata Studio User Guide, Release 16.00 201


Chapter 6: Table Data Development
Exporting Table Data
5. Under File Options, if you selected a delimited text file as the output, complete the following:
a. In Column Delimiter, select the column delimiter to be used in the output file to separate columns.
b. In Character String Delimiter, select the character string delimiter to be used in the output file to
indicate character strings.
6. In File Encoding, select the encoding standard to use.
7. Click Finish to export the data.

202 Teradata Studio User Guide, Release 16.00


CHAPTER 7
Data Transfer

About Transferring Data


Teradata Studio and Teradata Plug-in for Eclipse provide the capability for users and administrators to
seamlessly transfer data among the key component data platforms of Teradata's UDA: Teradata Databases,
Teradata Aster Databases, and Hadoop file systems. Data transfer features use drag-and-drop and point-
and-click interfaces in the Data Source Explorer, Transfer View, and Data Lab View to move data from one
system or table to another.
Integrated tools and features include:
Tool/Feature Description
Data Transfer Wizard The Data Transfer Wizard lets you select the source type
and destination type of a data transfer operation
Copy Object Wizard The Copy Object lets you copy tables and table data from
one Teradata system to another
Smart Load Wizard Use Smart Load for ad-hoc data movement. You can
move data to external files from Teradata Databases,
Teradata Aster Databases, and Hadoop file systems. You
also can move data stored in external files back into a
Teradata, Aster, or Hadoop system.
Load Data Wizard The Load Data Wizard loads data from an external file in
a file system.
Export Data Wizard The Export Data Wizard exports data from a table to an
external file.
Transfer Hadoop Table to Teradata Table The Transfer Hadoop Table to Teradata Table Wizard
Wizard imports data from a Teradata Database table to Hadoop.
Transfer Teradata Table to Hadoop Table The Transfer Teradata Table to Hadoop Table Wizard
Wizard exports data from Hadoop to a new Teradata table or to
an existing Teradata table.
Transfer Hadoop Table to Aster The Transfer Hadoop Table to Aster Wizard imports
data from a Hadoop table to an Aster table.

Transfer View
The Transfer View enables you to select a profile for a Teradata Database or Hadoop system, connect to the
system, and view a list of databases and tables in that system. The view displays the database objects in a tree
hierarchy that allows you to explore the structure of the data. For example, you can view a list of tables in the
selected database as well as stored procedures and macros.

Teradata Studio User Guide, Release 16.00 203


Chapter 7: Data Transfer
Data Transfer Wizard
Use the Transfer View in combination with the Data Source Explorer to transfer data from one Teradata or
Hadoop system to another. By dragging and dropping objects from one to the other, you can import and
export data between Teradata Databases and Hadoop systems. You can also copy table data from one
Teradata Database system to another. The appropriate dialogs automatically display to help you complete
the data transfer action.

Select Profile
Select a Connection profile from the list. The list displays the connection profiles to which you are already
connected. If you do not see the profile you want, it is probably not connected. To connect to a connection
profile, right-click Database Connections and select New. In the Connection Profile dialog select the type of
database to which you want to connect and complete the dialog information. See About Connection Profiles
for information about connecting.

Data Object Selection


After you select the profile, the Transfer View shows the hierarchical structure of the data in the database to
which you are connected. You can browse the structure to see the data it contains. The view shows lists of
indexes, macros, stored procedures, tables, user-defined functions, and views. You can drag and drop most
objects to a Teradata or Hadoop database displayed in the Data Source Explorer to export data to a different
database or user.

Transferring Data From Tables


1. Display the Data Transfer perspective.
2. In the Data Source Explorer, right-click Tables.
3. Select the Data Transfer command for the database type you are transferring data from:
• Teradata Database
• Teradata Aster Database
• Hadoop File System

Data Transfer Wizard

About the Data Transfer Wizard


The Data Transfer Wizard provides an initial dialog that enables you to select the source and destination
for your data transfer operation. The wizard pre-populates fields based on the database object you select in
the Data Source Explorer navigation pane. When you click Launch, the wizard opens the appropriate
dialog to collect additional information about your data transfer.

204 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard

Connection plus Data Object Name


Based on the object you select in the Data Source Explorer, the wizard shows the Connection Profile
name used to connect to the database and object selected.
Source of Data Transfer
The Source Type identifies the source for the data transfer operation. To load data to an object, you
must select a source type for the load operation. For example, a load operation with Teradata as the
destination requires that you select either Import from Hadoop or from an External File. Load
operations with Aster as the destination allow you to select Hadoop or External File (Smart Load).
Destination of Data Transfer
The Destination Type identifies the destination for the data transfer operation. To export data from an
object, you must select a destination type for the export operation. For example, types of destinations
from a Teradata source are Export to Hadoop, External File, and Teradata. The type of destination
from an Aster source type is External File.

Opening the Data Transfer Wizard


The Data Transfer Wizard opens when you right-click a Tables node or table object in the Data Source
Explorer.

From a Tables Node


You can navigate to a Tables node and right-click to select Teradata > Data Transfer from the menu.

Teradata Studio User Guide, Release 16.00 205


Chapter 7: Data Transfer
Data Transfer Wizard
From a Table Object
You can also open the Data Transfer Wizard from a table object when you open the Data Source Explorer
and select either Data > Export Data or Data > Load Data.

Working with Data Transfer Wizard


The Data Transfer Wizard enables you to identify the source and destination for exporting and loading
data. The wizard displays the profile name of the database connection to be used to transfer the data. Be sure
to verify that you selected the correct profile.
Each data transfer operation requires that you specify the source and destination for the transfer operation.
The Source Type and Destination Type fields indicate the type of data transfer operation you selected.

Transfer Data from Teradata Table


You can export data from a Teradata table (Source Type = Teradata):
• To another table in the same Teradata Database or in a different Teradata Database.
• To an external file in the file system, such as a text file or Microsoft Excel spreadsheet.
• To a Hadoop table.
To select which type of data transfer to perform, select a Teradata table object in Data Source Explorer
from which you want to export data ( Data > Export Data). In the Data Transfer Wizard, select the
destination for the data transfer. The options are:

Option Description
Teradata Opens the Copy Teradata Table wizard for specifying the Teradata
table that receives data.
External File (FastExport) Opens the Export Data Wizard which enables you to specify the
external file for the data transfer. The Teradata FastExport utility
performs the data transfer operation.
Hadoop Opens the Export Table to Hadoop wizard which enables you to
specify the Hadoop table object for the data transfer.

Transfer Data from Hadoop Table


You can export data from a Hadoop table (Source Type = Hadoop). Select one of the following Destination
Type options:

206 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard

Option Description
Teradata Opens the Hadoop Table Load to Teradata wizard for specifying the
Teradata table object that receives data.
Aster Opens the Transfer Hadoop table to Aster wizard for specifying the
Aster table object that receives the data.
External File Export data from Hadoop to an external file in your system.

Transfer Data to Teradata Table


You can transfer data to a Teradata table (Destination Type = Teradata). Select one of the following Source
Type options:

Option Description
Hadoop Opens the Hadoop Table Load to Teradata wizard which enables you
to specify the Teradata table object for the data transfer from Hadoop.
External File (FastLoad) Opens the Load Data Wizard which enables you to specify the
external file in your file system to which the data is loaded using the
Teradata FastLoad utility.

Transfer Data to Hadoop Table


You can load data to a Hadoop table (Destination Type - Hadoop). Select one of the following Source Type
options:

Option Description
Teradata Loads the data from a specified Teradata table.
External File (FastLoad) If Smart Loader is enabled for this connection, this option opens the
Load Data Wizard which enables you to specify the external file in
your file system to which the data is loaded.

Transfer Data to Aster


You can load data to a Teradata Aster Database (Destination Type - Aster).

Option Description
Hadoop Loads data from the selected Hadoop table to an Aster table.
External File Loads data from an external file in your system.

Transfer Data from Aster


You can export data from a Teradata Aster Database (Source Type = Aster)

Option Description
External File Exports data from Aster to an external file in your system.

Teradata Studio User Guide, Release 16.00 207


Chapter 7: Data Transfer
Data Transfer Wizard

Transferring Teradata Database Data

Data Transfer to Teradata


You can load data to a Teradata table by right-clicking the table and selecting Data > Load Data. The
Teradata table displays in the Data Transfer Wizard as the destination of the transfer (Destination Type =
Teradata).
Transfer Source Option Opens
Hadoop table Import from Hadoop Transfer Hadoop Table to Teradata Table
Wizard
External file in file system External File (FastExport)* Load Data Wizard

About Transfer Hadoop Table to Teradata Table


The Transfer Hadoop Table to Teradata Table wizard displays when you select Hadoop as the Source
Type with Teradata set as the Destination Type in the Data Transfer Wizard.

Teradata Destination

208 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard
You cannot edit Destination information. Teradata Connection Profile shows the Connection Profile
that is connected to the Teradata Database system. Teradata Table shows the database.table name
of the table selected to receive data.
Transfer From
You must specify the Hadoop data source for the transfer. Begin by selecting the Connection Profile
which displays a list of databases in the profile. After you select a database, a list of tables in the selected
database displays. Select the table that contains data you want transferred to the selected Teradata table.
Hadoop System
Select the profile for the Hadoop system that contains the data to be transferred. Use the list in Hadoop
Connection Profile to make your selection.
Hadoop Database
Select the database that contains the source table from the list.
Hadoop Table
Select the source table that contains the data to transfer.

Data Transfer From Teradata


With the Data Transfer Wizard, you can export data from a Teradata table by right-clicking the table and
selecting Data > Export Data. The Teradata table displays as the source of the transfer (Source Type =
Teradata). Choose one of these Destination types:
Destination Option Opens
Teradata table Teradata (Table Copy) Copy Object Wizard
Hadoop table Export to Hadoop Transfer Teradata Table to Hadoop Table
Wizard
External file in file system External File (FastExport) Export Data Wizard

Note:
When you transfer all table data in a database by right-clicking the database's Tables node in the Data
Source Explorer and selecting Teradata > Data Transfer > External file, the data transfer is performed
using the Teradata SmartLoad utility.

About Transferring a Teradata Table to a Hadoop Table


The Transfer Teradata Table to Hadoop Table wizard displays as below when you select Hadoop as the
Destination Type with Teradata as the Source Type in the Data Transfer Wizard.

Teradata Studio User Guide, Release 16.00 209


Chapter 7: Data Transfer
Data Transfer Wizard

Source of Data Transfer


Teradata Connection Profile shows the Connection Profile for the connected database that contains
the data to transfer. Teradata Table shows the database.table name of the Teradata table selected
for the data transfer to Hadoop.
Destination of Data Transfer
Specifies a Hadoop table to which to transfer data. You can choose to transfer data to an existing table or
to create a new table to receive the data.
Hadoop Connection Profile
Selects a Hadoop Connection Profile to which to connect.
Hadoop Database
The wizard displays a list of databases in the Connection Profile you selected. When you select a
database, a list of the tables in the database displays.
Transfer to New or Existing Table
You can indicate whether to create a new table by selecting Create New Table. To use an existing table,
clear the selection.
Hadoop Table
The Table field lists the tables in the selected Hadoop database. To transfer data to a table, select a table
and click Next.

210 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard
About Teradata to Hadoop Column Specification
The Column Specification dialog of the Transfer Teradata Table to Hadoop Table Wizard enables you
to set the name of a new Hadoop table and to specify which Teradata table columns to transfer to the
Hadoop table. You can view and assign mappings for the table column types. You can also set the job name
for the transfer operation.

Source
Displays the name of the Teradata Database and table database.table that are the source for the data
transfer. This information cannot be edited.
Destination
Displays the name of the Hadoop table to which the data is to be transferred. Enter the Delimiter to use
for the transfer.
Column Specification
Select the columns in the Teradata table to transfer to Hadoop. You must specify each column
individually.
Existing Destination Table Data
Specify whether to replace the data in the destination table or append it.
Job Name
Names the transfer job. You can change the job name, if necessary. The job name can be useful if the
export is an operation that you might re-execute in the future.
Reset
Sets all the fields back to their default values.

When you click Finish, the settings are passed to the Transfer Progress View where you can monitor the
status of the transfer job.

Transferring Aster Database Data

Data Transfer from Aster


You can export data from an Aster table by right-clicking the table and selecting Data > Export Data. The
Aster table displays in the Data Transfer Wizard as the source of the transfer (Source Type = Aster).

Note:
When you transfer all table data in a database by right-clicking the database's Tables node in the Data
Source Explorer and selecting Aster > Data Transfer > External file, the data transfer is performed
using the SmartLoad utility.

Exporting Data from Aster


1. Connect to a Teradata Aster Database using a Connection Profile.
2. Open Data Source Explorer and navigate to the Aster table you want to export.
3. Right-click the table name and select Data > Export Data.
4. In the Data Transfer Wizard, verify the Connection and Object names are correct.

Teradata Studio User Guide, Release 16.00 211


Chapter 7: Data Transfer
Data Transfer Wizard
5. Select External File (default) as the Destination Type and click Launch.
6. In the Export Data Wizard, type the directory path and name of the output file that receives the data.
You can find a file in your file system by clicking Browse to navigate to and select the file.
7. Select one of the following options in File Type:

Option Description
Delimited Text Text file that uses delimiters to separate data; such as, commas or semicolons in
a TXT or CSV file.
Excel (.xlsx) Microsoft Excel file with.xlsx file extension.
Excel 87-2003 (.xls) Microsoft Excel file with.xls file extension.
8. [Optional] Select the Column Labels in First Row check box to specify to use the first row of data as
the column labels for the new table.
9. If you selected Delimited Text as the file type, complete these fields:
Field Description/Action
Column Delimiter Type of delimiter to use in the output file using the list. The options
are:
Comma
Semicolon
Space
Tab
| (vertical bar)
Character String Delimiter Distinguishes a string text. The options are:
" (double-quotes)
' (single quote)
None
File Encoding Character set used to encode the data. The options are:
UTF-8
utf-16
ISO-8859-1
UTF-16BE
UTF-16LE
US-ASCB
Cp1252

If you selected Excel (.xlsx) or Excel 97-2003 (.xls), there are no additional options to complete.
10. Click Next to filter the Aster table data when it is exported and preview the generated SQL.
You can click Finish at any time to export data.
11. In Filter Selected Table indicate whether to filter by columns or by data for each column to be
exported using one of these methods:
Filter Option Action
Filter by a column Check the box beside the column name

212 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard

Filter Option Action


Filter by data For each table column select a filter value from the Select By list
and type the paired value. For example, the filter "> 200"" includes
only those values greater than the numeric value 200.
12. Review the generated SQL/DDL in the SQL Preview Filter and edit the SQL/DDL statements if
needed.
13. Click Finish.

Data Transfer to Aster


You can load data to an Aster table by right-clicking the table and selecting Data > Load Data. The Aster
table displays in the Data Transfer Wizard as the destination of the data transfer (Destination Type =
Aster).
Transfer Source Option Opens
External file in file system External File Load Data Wizard

You can also transfer Hadoop table data to an Aster table by right-clicking an Aster schema Tables node in
the Data Source Explorer and selecting Aster > Data Transfer. The Data Transfer opens with Hadoop
shown as the source and Aster as the destination.

Loading Data to an Aster Table


You can select a Teradata Aster Database table in the Data Source Explorer and load data to the table using
the Data Transfer Wizard.
1. Open the Data Source Explorer and navigate to a table object in an Aster database.
2. Right-click the table and select Aster > Load Data.
3. In the Data Transfer Wizard, select External File as the Source Type.
4. Click Launch.
5. In the Load Data Wizard, type the directory path and name of the file that contains data you want to
load.
You can find a file in your file system by clicking Browse to navigate to and select the file.
6. Select one of the following options in File Type to describe the data in the input file:

Option Description
Delimited Text Text file that uses delimiters to separate data; such as, commas or semicolons in
a TXT or CSV file.
Excel (.xlsx) Microsoft Excel file with.xlsx file extension.
Excel 87-2003 (.xls) Microsoft Excel file with.xls file extension.
7. [Optional] Select the Column Labels in First Row check box to specify to use the first row of data as
the column labels for the new table.
8. [Optional] Select the Lock Table check box to lock the table during the load operation.
9. [Optional] Select the Replace Existing Data check box if you want the existing data in the Aster table
to be replaced by the loaded data.
10. If you selected Delimited Text as the file type, complete these fields:

Teradata Studio User Guide, Release 16.00 213


Chapter 7: Data Transfer
Data Transfer Wizard

Field Description/Action
Column Delimiter Type of delimiter to be used. The options are:
Comma
Semicolon
Space
Tab
| (vertical bar)
Character String Delimiter Distinguishes a string text. The options are:
" (double-quotes)
' (single quote)
None.
File Encoding Character set to use to encode the data. The options are:
UTF-8
utf-16
ISO-8859-1
UTF-16BE
UTF-16LE
US-ASCB
Cp1252.
11. If you selected Excel (.xlsx) or Excel 97-2003 (.xls), select the Excel worksheet from which to load the
data.
12. Click Finish.

About Transfer Hadoop Table to Aster


The Transfer Hadoop Table to Aster Table wizard displays when you select Hadoop as the Source Type
in the Data Transfer Wizard and Aster as the Destination Type.

Aster Destination
Displays the Connection Profile that is connected to the Aster Database system. Aster Database shows
the name of the database selected to receive data. You cannot edit Destination information.
Transfer From
Specifies the Hadoop data source for the transfer. Begin by selecting the Connection Profile which
displays a list of databases in the profile. After you select a database, a list of tables in the selected
database displays. Select the table that contains data you want transferred to the selected Aster table.
Hadoop System
Selects the profile for the Hadoop system that contains the data to be transferred. Use the list in Hadoop
Connection Profile to make your selection.
Hadoop Database
Selects the database that contains the source table from the list.
Hadoop Table
Selects the source table that contains the data to transfer.

214 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard
About Hadoop to Aster Column Specification
The Column Specification dialog of the Transfer Hadoop Table to Aster Table Wizard enables you to
map data to columns when transferring data from Hadoop to an existing Aster table.

Data Source
The name of the Hadoop table that is the source for the transfer. You cannot edit this information.
Destination for Data Transfer
The name of the Aster database to which the data is to be transferred. The table you selected in the
previous wizard screen displays in the Aster Table field. You can select a different table.
Columns to Transfer
Select check boxes to indicate which columns in the Hadoop table to transfer to the Aster table. By
default the column data type of the Aster table is based on the column data type of the source Hadoop
table. Verify the column data type and use the list to select a different data type if needed. You are able to
set the data type for each column in the table.
Select Column Buttons
You can select to transfer all columns by clicking Select All or no columns to be transferred by clicking
Select None at the bottom of the column list.
Naming of Job
The name for the transfer job displays at the bottom of the screen. You can change the job name.
Reset All Values
Sets all the fields back to their default values.

Teradata Studio User Guide, Release 16.00 215


Chapter 7: Data Transfer
Data Transfer Wizard
About Hadoop to Aster SQL Preview
The SQL Preview dialog of the Transfer Hadoop Table to Aster Table Wizard enables you to view the
generated SQL statement.

SQL Text Generated


The SQL text is based on your selections in the Transfer Hadoop Table to Aster Table wizard. You can
return to previous wizard screens to refine your selections and modify the generated SQL statement.
When you are ready, click Finish to create the Aster table. The wizard returns you to the Transfer
Progress view where you can monitor the progress of the transfer operation.

Transferring Hadoop Data

Data Transfer from Hadoop


With the Data Transfer Wizard, you can export data from a Hadoop table by right-clicking the table and
selecting Data > Export Data. Hadoop displays as the source of the transfer (Source Type = Hadoop).
Possible destination include Aster, Teradata, or External File.

216 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Data Transfer Wizard
Another option when transferring Hadoop data is to drag and drop a Hadoop table object from the Data
Source Explorer to the Transfer View window. The Data Transfer Wizard launches and opens the Column
Specification dialog to allow you to specify which columns to transfer.

Note:
When you transfer all table data in a database by right-clicking the database's Tables node in the Data
Source Explorer and selecting Hadoop > Data Transfer > External file, the data transfer is performed
using the Teradata FastExport utility.

Data Transfer to Hadoop


With the Data Transfer Wizard you can load data to a Hadoop table object by right-clicking the table and
selecting Data > Load Data. The Hadoop table displays as the destination of the data transfer.
At Source Type, select the source of the data, either Teradata or External File.

About Transfer Teradata Table to Hadoop


The Transfer Teradata Table to Hadoop Table wizard displays when you select Teradata as the Source
Type with Hadoop selected as the Destination Type in the Data Transfer Wizard.

Destination
Verify the destination information is correct. Hadoop Connection Profile shows the Connection
Profile connected to the target Hadoop system. Hadoop Table shows the database.table name of
the table selected to receive data.
Source

Teradata Studio User Guide, Release 16.00 217


Chapter 7: Data Transfer
About Copying Teradata Objects
You must specify the Hadoop data source for the transfer. Begin by selecting the Connection Profile
which displays a list of databases in the profile. After you select a database, a list of tables in the selected
database displays. Select the table that contains data you want transferred to the selected Hadoop table.

About Teradata to Hadoop Column Specification


The Column Specification dialog of the Transfer Teradata Table to Hadoop Table Wizard enables you
to set the name of a new Hadoop table and to specify which Teradata table columns to transfer to the
Hadoop table. You can view and assign mappings for the table column types. You can also set the job name
for the transfer operation.

Source
Displays the name of the Teradata Database and table database.table that are the source for the data
transfer. This information cannot be edited.
Destination
Displays the name of the Hadoop table to which the data is to be transferred. Enter the Delimiter to use
for the transfer.
Column Specification
Select the columns in the Teradata table to transfer to Hadoop. You must specify each column
individually.
Existing Destination Table Data
Specify whether to replace the data in the destination table or append it.
Job Name
Names the transfer job. You can change the job name, if necessary. The job name can be useful if the
export is an operation that you might re-execute in the future.
Reset
Sets all the fields back to their default values.

When you click Finish, the settings are passed to the Transfer Progress View where you can monitor the
status of the transfer job.

About Copying Teradata Objects


You can copy Teradata Database objects from one Teradata system to another using the Data Source
Explorer.
Any of the following methods can be used to copy objects:
• Selecting a Teradata object and choosing the Teradata > Data Transfer command.
• Dragging and dropping objects to the Transfer View in the Data Transfer perspective.
• Dragging and dropping table objects to the Teradata Data Lab view.
You can select and copy multiple objects.

218 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
About Copying Teradata Objects

Copying Objects Using the Data Transfer Wizard


You can copy Teradata table objects in the Data Source Explorer to another database.
1. Open two Connection Profiles, one for the source database system and another for the destination
system.
2. Open the Data Source Explorer.
3. Navigate to the database and Tables folder to which you want to copy data from another table.
4. Right-click Tables and select Teradata > Data Transfer.
5. Select Teradata as the Source Type.
6. Verify the Destination platform is correct.
It should read Teradata.
7. Click Launch.
8. Verify the Destination information is correct.
If it is not correct, click Cancel and return to step 3 to select a different destination database.
9. Select the Teradata Connection Profile for the database that contains the data you want to copy.
10. Select from the Database list the specific database that contains the table data.
11. Select from the Table list the table that contains the data to be copied.
12. Click Next.
13. Verify the Source and Destination information is correct.
14. Select from these options:

Option Description
Copy Data Copies the data with the table.
Lock Table Locks the table during the Copy Object operation.
15. Click Next.
16. Identify the specific data you want to include in the data transfer operation using one of the following:

Option Description
De-select columns Un-check the box beside the table column you do want transferred.
you do not want to
include
Filter data Use the filter list to select the filter type and type a value on which to filter the
data. For example, for PhoneNo if you select the filter "equal to" (=) and enter
the value 315*, only phone numbers that begin with area code 315 are
transferred. The default is None.
17. Review the Job Name information and if needed, edit the name.
18. Click Next.
19. In SQL Summary, review the generated Data Definition Language (DDL) script for the transfer.
Some objects, such as macros, display blank.
20. [Optional] If you want to save the DDL script, click Save DDL to open the SQL Save dialog and specify
a file location and name.
21. Click Finish to run the transfer job.
The Copy Object Wizard prompts you that the object created successfully or failed.

Teradata Studio User Guide, Release 16.00 219


Chapter 7: Data Transfer
About Copying Teradata Objects
22. If the transfer operation is successful you can monitor the data transfer job in the Transfer Progress
View or review details about the data transfer job in the Transfer History View.

Copying Table Data Between Teradata Databases


The Copy Object Wizard copies Teradata table data from one Teradata Database to another.
1. Open the Data Source Explorer and navigate to the Tables folder in a Teradata Database.
2. Right-click a table object and select Data > Load Data.
3. In the Data Transfer Wizard, select Teradata as the Source Type and click Launch.
4. Select the table to copy by specifying Source information:
a) Select from the list the Teradata Connection Profile that contains the table to copy.
b) Select the Database that contains the table object.
c) Select the Table to copy.
5. Click Next.
6. [Optional] Specify which columns are to receive data from the source table, and select whether to
append the data or replace existing data in the destination table.
7. In Job Name, accept the default name or rename the Copy Object job.
8. Click Next
9. In SQL Summary, review the generated Data Definition Language (DDL) script for the transfer.
Some objects, such as macros, display blank.
10. [Optional] If you want to save the DDL script, click Save DDL to open the SQL Save dialog and specify
a file location and name.
11. Click Finish to run the transfer job.
The Copy Object Wizard prompts you that the object created successfully or failed.
12. If successful, monitor the data transfer operation in the Transfer Progress View.
13. Review details about the data transfer operation in the Transfer History View.

Dropping Objects on Transfer View


Objects can be dragged from the Data Source Explorer and dropped into the Transfer View and back to
copy from one database to another.
The following instructions are specific to dragging from Data Source Explorer and dropping into the
Transfer View.
1. Open two Connection Profiles, one for the source database system and another for the destination
database system of the transfer.
2. Open the Data Source Explorer and navigate to the Teradata Database object you want to copy to
another system.
3. Open the Transfer View by opening the Data Transfer perspective or selecting Window > Show
View > Transfer View.
4. In the Transfer View, use the Teradata system to which you want to copy the object from the Select
Profile list.
If the system you want is not listed, return to the Data Source Explorer and right-click Database
Connections to select New and connect to the correct profile.

220 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
About Copying Teradata Objects
5. Select the Data Source Explorer object and drag and drop it into the Transfer View pane to launch
the Copy Object Wizard.
Be sure to drop the object on a folder of the same type or on a database/user folder.
6. Verify that the information shown for Source and Destination systems is correct, and the object to be
copied is correct.
The name of the source object is used by default to identify the destination object.
7. [Optional] If copying a table object, select from these options:

Option Description
Copy Data Copies the data with the table.
Lock Table Locks the table during the Copy Object operation.
8. Click Next.
9. [Optional] If you are copying a table, select one of these methods to transfer the data:

Option Description
Transferring data to a new Select each column you want transferred. You can filter data by
table specifying filter values for individual columns. The default is None.
Transferring data to an Specify which columns are to receive data from the source table, and
existing table select whether to append the data or replace existing data in the
destination table.
10. In Job Name, accept the default name or rename the Copy Object job.
11. Click Next.
12. In SQL Summary, review the generated Data Definition Language (DDL) script for the transfer.
Some objects, such as macros, display blank.
13. [Optional] If you want to save the DDL script, click Save DDL to open the SQL Save dialog and specify
a file location and name.
14. Click Finish to run the transfer job.
The Copy Object Wizard prompts you that the object created successfully or failed.
15. If the transfer operation is successful you can monitor the data transfer job in the Transfer Progress
View or review details about the data transfer job in the Transfer History View.

About Copy Table


When you drag and drop a table from the Data Source Explorer both the Copy source and destination
Teradata Database names display in the Copy Table screen of the Copy Object Wizard.

Teradata Studio User Guide, Release 16.00 221


Chapter 7: Data Transfer
About Copying Teradata Objects

Source Database
The source information includes the names of the Connection Profile, Database, and Table from which
the data is copied.
Destination Database
The destination information includes the names of the Connection Profile, Database, and Table to which
the Copy Object Wizard copies the data.
Instructions for Copy Job
You can specify these options for the Copy job:
Option Description
Copy Data Creates the destination table and copies the source data to the new
table.
Lock Table Locks source and destination tables during the data transfer.

Copy Object Support


The Copy Object Wizard supports copying the following objects from one Teradata Database to another.
In addition, Table and Table Data can be copied from a Teradata Database to a Data Lab.

222 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Copy Object Wizard
• Database
• User
• Table and Table Data
• Macro
• SQL Stored Procedure
• SQL User-defined Function
• Hash Index
• Join Index
• User-defined Type
• View Definitions

Copy Object Wizard

About the Copy Object Wizard


The Copy Object Wizard enables you to copy objects from one Teradata system to another. When you
select a table to copy, you can use data filters to specify which columns and data to transfer. You can also
lock the table while you are transferring data.
You can transfer Teradata tables by using the Data Transfer Wizard Transfer command or by using the
drag-and drop feature. If you use the Data Transfer Wizard to copy data to and from tables in different
Teradata systems, the Copy Object Wizard performs the data transfer.
The Copy Object Wizard consists of several screen interfaces:

Interface Description
Copy Table Shows the database and object name of the data source and
destination. Use this screen to verify that the transfer information is
correct. You can select Copy Data to copy the data in the source table
to the destination table. A Lock Table option allows you to lock the
tables during the transfer.
Filter Copy Columns Enables you to select which columns in the table to transfer. The Filter
Copy Columns screen is specific to table objects. After you select a
column, you can filter for the data in that column to transfer. The
default is to transfer all data.
Column Specification Enables you to select which columns to transfer and which data type to
assign when copying table data to an existing table.
SQL Summary Displays the generated Data Definition Language (DDL) script that
copies the source object to its destination. You can save the DDL and
run it later or create the transfer job to run it immediately by clicking
Finish.

Teradata Studio User Guide, Release 16.00 223


Chapter 7: Data Transfer
Copy Object Wizard

About Filter Copy Column


The Copy Object Wizard enables you to review the source table columns and specify which columns and
data you want copied to a new destination table.

Column Filter
Allows you to select a filter type from the list, and if appropriate, enter a filter value in the text box. You
must enter a value that is valid for the column data type. The data type displays beside the column name.
Column Select for Copy
You can select the check box beside a column name to copy the column to the destination table. All
columns are selected by default.
Actions on All Columns
All columns are selected by default. Use the Clear All and Select All buttons to act on all columns in the
table.
Copy Data Job Name
Copy Object Wizard generates a default job name based on the source table name. You can edit the
default job name.

224 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Copy Object Wizard

About Column Specification


The Copy Object Wizard enables you to copy Teradata table data to another existing Teradata table. You
can select whether a column is copied by selecting a column name and data type for the new destination
column. Filters allow you to specify smaller sets of data to copy.

Source Columns
The Source Column Name/Type lists the table columns stored in the source database you selected. You
select which of the columns you want copied to the destination table by specifying a name for the an
existing column in the destination table.
Destination Columns
The Destination Column Name/Type displays one option list for each source column. Use the option
list to map the source column name and data type to an existing destination column.
Column Filter
Select a filter type from the list, and if appropriate, enter a filter value in the text box. You must enter a
value that is valid for the column data type. The data type displays beside the column name.
Instructions for Copy Job
Provides the following options to specify how you want data copied to the destination table:

Teradata Studio User Guide, Release 16.00 225


Chapter 7: Data Transfer
Copy Object Wizard

Option Description
Append data to destination Appends the copied data to the end of existing data in the table.
table
Replace existing data in Replaces any existing data in the destination table with the copied
destination table data.

Copy Data Job Name


Copy Object Wizard generates a default job name based on the source table name. You can edit the
default job name.
Reset Action
The Reset button return all values in the screen to their default settings.

Column Data Type


Data Type Description
BINARY LARGE OBJECT Large binary string of raw bytes
BYTE Fixed length binary string
BYTEINT Signed binary integer value in the range of -128 to 127.
CHARACTER Fixed length character string
CHARACTER LARGE OBJECT Large character string
DATASET Complex data type (CDT) representing self-describing files that are
interpreted based on a schema
DATE Date consisting of year/month/day
DECIMAL Decimal number with fixed number of digits and a fixed number of
digits to the right of the decimal point
FLOAT Floating point number
INTEGER 32-bit binary integer
INTERVAL DAY An interval defining a period of time in days
INTERVAL DAY TO HOUR An interval defining a period of time in days and hours
INTERVAL DAY TO MINUTE An interval defining a period of time in days, hours and minutes
INTERVAL DAY TO SECOND An interval defining a period of time in days, hours, minutes and
seconds
INTERVAL HOUR An interval defining a period of time in hours
INTERVAL HOUR TO MINUTE An interval defining a period of time in hours and minutes
INTERVAL HOUR TO SECOND An interval defining a period of time in hours, minutes and seconds
INTERVAL MINUTE An interval defining a period of time in minutes

226 Teradata Studio User Guide, Release 16.00


Chapter 7: Data Transfer
Copy Object Wizard

Data Type Description


INTERVAL MINUTE TO An interval defining a period of time in minutes and seconds
SECOND
INTERVAL MONTH An interval defining a period of time in months
INTERVAL SECOND An interval defining a period of time in seconds
INTERVAL YEAR An interval defining a period of time in years
INTERVAL YEAR TO MONTH An interval defining a period of time in years and months d seconds
JSON (JavaScript Object Notation) text-based, data interchange format used
in web applications to transmit data
NUMBER A numeric value with optional precision and scale limitations
PERIOD(DATE) A period of dates consisting of year/month/day. (This type is available
only for Teradata 13 and later.)
PERIOD(TIME) A period of times consisting of hour/minute/second/fractional second.
(This type is available only for Teradata 13 and later.)
PERIOD(TIME WITH TIME A period timestamp with displacements from UTC. (This type is
ZONE) available only for Teradata 13 and later.)
PERIOD(TIMESTAMP) A period of timestamps consisting of year/month/day/hour/minute/
second/fractional second. (This type is available only for Teradata 13
and later.)
PERIOD(TIMESTAMP WITH A period of timestamps with displacements from UTC. (This type is
TIME ZONE) available only for Teradata 13 and later.)
SMALLINT 16-bit binary integer
ST_GEOMETRY Used for creating and manipulating geometric shapes in the database
TIME A time consisting of hour/minute/second/fractional second
TIME WITH TIME ZONE A time with a displacement from UTC
TIMESTAMP A timestamp consisting of year/month/day/hour/minute/second/
fractional second
TIMESTAMP WITH TIME A timestamp with a displacement from UTC
ZONE
User-defined Type A user-defined type (udt). This option appears only for systems that
support user-defined types.
VARBYTE Variable length binary string
VARCHAR Variable length character string
XML (Extensible Markup Language) text-based, data format used for
application integration to format messages passed between
applications and as a document format for storing data

Teradata Studio User Guide, Release 16.00 227


Chapter 7: Data Transfer
Copy Object Wizard

About SQL Summary


The generated Data Definition Language (DDL) script that copies the source object to its destination
displays in the SQL Summary screen.

Generated DDL Script


DDL Script generated from the information you provided in previous screens of the Copy Object
Wizard. Run this script to perform the copy operation.
Save DDL
Saves the DDL to a file where you can continue to edit the text and run the copy operation at a later time.

228 Teradata Studio User Guide, Release 16.00


CHAPTER 8
Data Import and Export

Importing Data Into a Volatile Table


Prerequisite
Volatile tables must be created manually, by executing CREATE VOLATILE TABLE statements from the
SQL Editor.

Volatile tables exist only during the session in which they are created. When a database session ends,
Teradata Database automatically drops all volatile tables that were created during the session. After you have
created a volatile table, use the Load Data wizard to import external data into the table.

1. In the SQL Editor view, click .


The Load Data to Volatile Table dialog opens.
2. From the Volatile Table list, select the volatile table to which you want to import data, and click OK.
Importing data to volatile tables is the purview of the Data Transfer perspective. The Switch
Perspective dialog box may appear and offer to switch you to that perspective during this process.
Switching perspectives is optional. The Data Transfer perspective shows the progress of the data import
in the Progress Monitor view, and includes the Transfer History view, which may be helpful.
After switching perspectives or dismissing the Switch Perspective dialog, the Data Transfer Wizard
opens.
3. In the Data Transfer Wizard, for Source Type chose External File (FastLoad), and click Launch.
The Load Data Wizard opens.
4. For File Type specify the format of the file that has the external data.
5. For Input File, enter the name of the file, or click Browse to navigate to the file on your system or
network.
A sample of the data in the file is displayed in a tabular form preview of how the data will import to the
table. If the sample data is not laying out correctly, use the controls in the wizard to specify how the data
is formatted in the external file, and how you want the data to be parsed as it is imported to the database.
6. Click Finish.
The external data is imported to the volatile table.

Import and Load External Data (Teradata, Aster)

About the Load Data Wizard (Teradata, Aster)


Once you have selected the table to receive the data in the Data Source Explorer, You can specify the type
of data import you want performed.

Teradata Studio User Guide, Release 16.00 229


Chapter 8: Data Import and Export
Import and Load External Data (Teradata, Aster)
Note:
You must select External File (FastLoad) as the Source Type to launch the Load Data Wizard.

After the Load Data Wizard opens, specify the name, path, and external file type of the source file. Be sure
to specify data delimiters and encoding used in the source file. Use the drop-down lists to select the correct
information.

230 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Import and Load External Data (Teradata, Aster)
Load Data Wizard (Teradata, Aster)
The Load Data Wizard enables you to load data from an input file into a table using either JDBC FastLoad
or batch operations. The input file can be a delimited text file or an Excel file. If the table is not empty, the
Load Data Wizard appends or replaces the existing data.

Note:
JDBC FastLoad operations are not applicable to Aster data transfers.

The Load Data Wizard contains the following elements:

Option Description
Input File Specify the path and name of the file from which to import data and to
specify the server path to its location in the file system. To locate an
existing file, click Browse and navigate the file system to select a file.
File Type Select the type of file to be imported. You can choose to load data from
a text file, such as a.txt or.cvs file, or from a Microsoft Excel file.
Choose between a.xslx file, or.xls (Microsoft Excel 97-2003) file. The
file data options change depending on which type of source file you
selected.
Column Labels in First Row Select to specify that the first row in the file contains the column labels
so that the first row in the file is ignored.
Stop Loading If Max Error(s) Specify the maximum number of errors allowed before the wizard
Occur stops the Load operation.
Lock Table Select to prevent row lock errors.

Note:
Selecting this option may cause the import operation to be slow.

Replace Existing Data If the table is not empty, check this option to replace the existing data.
Leaving it cleared appends the loaded data to the existing data. If the
table is empty, this option is grayed out.

The File Options change depending on the file type you select, and the destination. For example, the
Delimited Text options are:

Option Description
Column Delimiter Specify the column delimiter used in the input file.
This does not apply to Hadoop.
Character String Delimiter Specify the character string delimiter used in the input file.
This does not apply to Hadoop.
Line Separator Specify the type of column delimiters, character string delimiters, and
character encoding the data in the imported file uses. If you specified
an EXCEL spreadsheet as the input file and selected either EXCEL
(.xlsx) or EXCEL 97-2003 (.xls) as the file type, you can import data
from a single worksheet in the file by selecting a worksheet name in
Import Worksheet. The Line Separator options enable you to import
files that have only LineFeed (LF), as in Unix and Linux, or only

Teradata Studio User Guide, Release 16.00 231


Chapter 8: Data Import and Export
Import and Load External Data (Teradata, Aster)

Option Description
Carriage Return (CR) as in Mac OS/X prior to v10.0, or both, as for
Windows. The options are:
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)

File Encoding Specify the type of encoding to used for the file.
Start Loading at Row Number Specify the table row number where the Load operation begins.

The Excel options are:

Option Description
Import Worksheet Import Worksheet - View a list of worksheets found in the specified
Excel file. Specify which worksheet you want to import.
Start Loading at Row Number Specify the table row number where the Load operation begins.

Data contained in the external file displays at the bottom of the wizard screen. Table data includes column
name, column data type, and values in table rows.
When you click Finish, the results display in the Teradata SQL History view. Click the Message tab to view
detailed messages.

Loading Table Data from a File (Teradata, Aster)


1. Open the Data Transfer perspective.
2. Select a Teradata or Aster table in the Data Source Explorer as the destination table.
3. Right-click the table and select Data > Load Data.
4. In the Data Transfer Wizard, select External File as the Source Type.
5. Click Launch.
The Load Data Wizard opens.
6. At Input File, type the directory path and name of the file that contains the data you want to import.
To find a file in your file system, click Browse, select the file, and click Open.
7. In File Type, select one of the following options:

Option Description
Delimited Text Text file that uses delimiters to separate data; such as, commas or semicolons in
a TXT or CSV file.
Excel (.xlsx) Microsoft Excel file with.xlsx file extension. This is not available for Hadoop.
Excel 87-2003 (.xls) Microsoft Excel file with.xls file extension. This is not available for Hadoop.
8. [Optional] Select Column Labels in First Row to use the first row of data as the column labels for the
new table.
9. Select Stop Loading If Max Error(s) Occur and specify the maximum number of errors allowed
before the Load operation stops.

232 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Import and Load External Data (Teradata, Aster)
10. [Optional] Select Lock Table to lock the source and destination tables during the Load operation.
11. [Optional] Select Replace Existing Data to specify that data in the source file replaces any existing data
in the destination file.
12. Complete the File Options.
For example, if you selected Delimited Text, complete the following fields:
a) In Column Delimiter, select the delimiter that you want used to separate data.
• Comma — Uses commas (,) to separate data in destination file
• Semicolon — Uses semicolons (;) to separate data in destination file
• Space — Uses blank spaces to separate data in destination file
• Tab — Uses Tabs to separate data in destination file
• Fixed Width — Uses fixed width columns to separate data. Specify in Fixed Width Columns a
numeric value for the fixed column width.
• I — Inserts a vertical bar (I) to separate data
b) Select the Character String Delimiter to use to distinguish string text.
The options are " (double-quotes), ' (single quote), or None.
c) In Line Separator, select one of the following options based on the operating system from which
the data is imported. This option enables you to import files with only Carriage Returns (CR), only
LineFeeds (LF), or both Carriage Returns and LineFeeds (CR and LF).
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)
d) In File Encoding, select the character set to use to encode the data.
The options are: UTF-8, utf-16, ISO-8859-1, UTF-16BE, UTF-16LE, US-ASCB, Cp1252.
e) In Start Loading At Row Number, type the table row number at which you want the wizard to
start loading data.
This option does not apply to Hadoop.
A sample of the input file based on the options you select displays below the File Options. If you
change the values selected in File Options fields, the sample row display also changes.
13. Click Finish.
The wizard returns you to the Transfer History View where you can view the report on the Load
operation success or failure.

About the Load Data Wizard and JDBC


The JDBC Driver returns SQL warnings if it determines that a FastLoad operation is not possible. This
might be due to incompatible column data types; for example, CLOB or BLOB data types. If this occurs, the
JDBC Driver processes the batch insert in a non-FastLoad mode.

Note:
The JDBC Driver feature is not applicable for Aster data transfers.

When loading data, not all data type conversions supported by the Teradata JDBC Driver are supported by
JDBC FastLoad or JDBC addBatch. This is an issue related to Date, Time, and Timestamp data types.
Teradata recommends that when you load data for these data types, use the following JDBC escape formats:
• JDBC Date escape format is: yyyy-mm-dd.

Teradata Studio User Guide, Release 16.00 233


Chapter 8: Data Import and Export
Import and Load External Data (Hadoop)
• JDBC Time escape format is: hh:mm:ss.
• JDBC Timestamp escape format is: yyyy-mm-dd hh:mm:ss.ffffff.

Import and Load External Data (Hadoop)

About the Load Data Wizard (Hadoop)


Once you have selected the table to receive the data in the Data Source Explorer, You can specify the type
of data import you want performed.

Note:
You must select External File as the Source Type to launch the Load Data Wizard.

After the Load Data Wizard opens, specify the name, path, and external file type of the source file. Use the
drop-down lists to select the correct information.

234 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Import and Load External Data (Hadoop)

Load Data Wizard (Hadoop)


The Load Data Wizard enables you to load data from an input file into a table using a combination of
WebHDFS and JDBC. The input file must be a delimited text file. If the table is not empty, the Load Data
Wizard appends or replaces the existing data.
The Load Data Wizard for Hadoop contains the following elements:

Option Description
Input File Specify the path and name of the file from which to import data and to
specify the server path to its location in the file system. To locate an
existing file, click Browse and navigate the file system to select a file.
File Type File type is Delimited Text. This cannot be changed.
Delimiter The delimiter corresponds to the delimiter of the Hadoop table you are
importing.

Teradata Studio User Guide, Release 16.00 235


Chapter 8: Data Import and Export
Import and Load External Data (Hadoop)

Option Description
Table File Format The table file format corresponds to the table file format of the Hadoop
table you are importing.
Replace Existing Data If the table is not empty, check this option to replace the existing data.
Leaving it cleared appends the loaded data to the existing data. If the
table is empty, this option is grayed out.
Line Separator Specify the line separator used in the file you are importing. .
File Encoding Specify the type of encoding to used for the file.

Data contained in the external file displays at the bottom of the wizard screen. Table data includes column
name, column data type, and values in table rows.
When you click Finish, a file transfer job is launched in the Transfer Progress View view. When the
transfer is complete, it is displayed in the Transfer History View.

Loading Table Data from a File (Hadoop)


1. Open the Data Transfer perspective.
2. Select a Hadoop table in the Data Source Explorer as the destination table.
3. Right-click the table and select Data > Load Data.
4. In the Data Transfer Wizard, select External File as the Source Type.
5. Click Launch.
The Load Data Wizard opens.
6. At Input File, type the directory path and name of the file that contains the data you want to import.
To find a file in your file system, click Browse, select the file, and click Open.
7. [Optional] Select Replace Existing Data to specify that data in the source file replaces any existing data
in the destination file.
8. In Line Separator, select one of the following options based on the operating system from which the
data is imported. This option enables you to import files with only Carriage Returns (CR), only
LineFeeds (LF), or both Carriage Returns and LineFeeds (CR and LF).
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)
9. In File Encoding, select the character set to use to encode the data.
The options are: UTF-8, UTF-16, ISO-8859-1, UTF-16BE, UTF-16LE, US-ASCB, Cp1252.
A sample of the input file based on the options you select displays below the File Options. If you
change the values selected in File Options fields, the sample row display also changes.
10. Click Finish.
When you click Finish, a file transfer job is launched in the Transfer Progress View view. When the
transfer is complete, it is displayed in the Transfer History View.

236 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
About Smart Load Wizard (Teradata, Aster)

About Smart Load Wizard (Teradata, Aster)


The Smart Load Wizard enables you to create Teradata or Aster tables from data stored in an external file.
This screen varies with destination system and options selected.

Import File
Enter the path and name for the file to import or click Browse to find a file on your file system.
File Type
Select the type of file to import. The default file type is delimited text. The Microsoft Excel file type has
options for files with .xlsx and .xls extensions.
Column Labels in First Row
Select to specify that the first row in the file contains the column labels so that the first row in the file is
ignored.

Teradata Studio User Guide, Release 16.00 237


Chapter 8: Data Import and Export
About Smart Load Wizard (Teradata, Aster)
Quick Scan
Select to scan the file partially when trying to derive a table from the imported data.
Column Delimiter
Specify the column delimiter used in the input file.
Character String Delimiter
Specify the character string delimiter used in the input file.
Line Separator
Specify the type of column delimiters, character string delimiters, and character encoding the data in the
imported file uses. If you specified an EXCEL spreadsheet as the input file and selected either EXCEL
(.xlsx) or EXCEL 97-2003 (.xls) as the file type, you can import data from a single worksheet in the file by
selecting a worksheet name in Import Worksheet. The Line Separator options enable you to import files
that have only LineFeed (LF), as in Unix and Linux, or only Carriage Return (CR) as in Mac OS/X prior
to v10.0, or both, as for Windows. The options are:
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)

File Encoding
Specify the type of encoding to used for the file.

Creating Tables with Smart Load (Teradata, Aster)


Use this procedure to create a new Teradata or Aster table by importing data from an external file.
1. In Data Source Explorer right-click Tables on a Teradata or Aster system.
2. Choose the correct option for your system:

Option Action
Teradata Teradata > Data Transfer
Aster Aster > Data Transfer

The Data Transfer Wizard displays.


3. In Source Type, select External File (Smart Load).
4. Click Launch.
The Smart Load Wizard opens.
5. In Input File, type the directory path and name of the file that contains data you want to use to build a
table. You can also browse to the file.
6. Select the File Type for the input file:

Option Description
Delimited Text Text file that uses delimiters to separate data; such as, commas or semicolons in
a TXT or CSV file.
Excel (.xlsx) Microsoft Excel file with .xlsx file extension.

238 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
About Smart Load Wizard (Teradata, Aster)
Option Description
Excel 87-2003 (.xls) Microsoft Excel file with .xls file extension.
7. [Optional] Select Column Labels in First Row to specify to use the first row of data as the column
labels for the new table.
8. [Optional] In Drop Table if Max Error(s) Occur, type the maximum number of errors that a table
can have before it is dropped from the import operation.
9. [Optional] If you selected Delimited Text, select Quick Scan to scan the file partially when trying to
derive a table from the imported data.
10. If you selected Delimited Text, use the list in Column Delimiter to select the delimiter that is used to
separate data in the input file.

Option Description
Comma Input file data is separated by commas (,)
Semicolon Input file data is separated by semicolons (;)
Space Input file data is separated by blank spaces
Tab Input file data is separated by Tabs
Fixed Width Input file data has fixed width columns. Specify in the Fixed Width Columns field a
numeric value for the fixed column width.
I Vertical bar (I) is used to separate data
11. If you selected Delimited Text, select the Character String Delimiter to use to distinguish string text.
The options are " (double-quotes), ' (single quote), or None. This option does not apply to Hadoop.
12. If you selected Delimited Text, in Line Separator select one of the following options based on the
operating system from which the data is imported. This option enables you to import files with only
Carriage Returns (CR), only LineFeeds (LF), or both Carriage Returns and LineFeeds (CR and LF).
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)
13. If you selected Delimited Text, in File Encoding select the character set to use to encode the data.
The options are: UTF-8, utf-16, ISO-8859-1, UTF-16BE, UTF-16LE, US-ASCB, Cp1252.
14. Click Next.
The Table Column Data Types screen displays.
15. In Table Name, type the name of the table to be derived from the loaded data.
16. [Teradata Only] In Primary Index, select whether this table will have a primary index, and whether it
is unique.
The Teradata primary index is used to evenly distribute data among AMPs.A non-unique primary
index permits the insertion of duplicate field values.
17. Select the Table Type.
18. To edit the data types of a specific column, click (ellipses) in the column header.
19. Select one of the following:

Teradata Studio User Guide, Release 16.00 239


Chapter 8: Data Import and Export
About Smart Load Wizard (Teradata, Aster)
Option Description
Click Next Previews the SQL/DDL code that creates the new table. You can edit the SQL
statements in the Generated SQL text area by clicking Show in Editor. If you choose
to open the SQL Editor, the Smart Load Wizard closes. You can run the SQL query
statements from the SQL Editor to create the table.
Click Finish Creates the table and imports the data from the file.

Editing Column Data Types (Teradata, Aster)


You can edit the data type for a table column prior to importing data in the Smart Load Wizard. The exact
menu options vary depending on the table type and the column type.

1. On the Data Types page, click the ellipsis next to the data type to change.
2. In Type select the data type for the column you are editing.
The remaining options vary depending on the data type.
3. Select Can contain nulls if the data in the column can include null values.
This action de-selects Values must be unique if it is selected.
4. Select Values must be unique if the data in the column must be unique values.
This action deselects Can contain nulls.
5. If you selected SMALLINT as the data type, you can select Distribute by Hash if you want specify a
distribution key column.
Using Distribute by Hash with a distribution key is mandatory for fact tables and optional for
dimension tables. Joins involving columns that are part of a distribution key constraint will be optimized.
6. Click OK.

240 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
About Smart Load Wizard (Teradata, Aster)

Smart Load Data Types for Teradata Tables


The following data types are supported in the Smart Load Wizard for Teradata tables.

Teradata Data Type Description


BYTE Fixed length binary string
CHARACTER Fixed length character string. In Size type the size limit of the
character string.
CHARACTER LARGE OBJECT Large character string
DATE A date consisting of year/month/day
DECIMAL Decimal number with fixed number of digits and a fixed number of
digits to the right of the decimal point
DOUBLE PRECISION Floating-point data type. There are no additional options.
FLOAT Floating point number
INTEGER 32-bit binary integer. There are no additional options.
INTERVAL There are no additional options.
INTERVAL DAY An interval defining a period of time in days
INTERVAL DAY TO HOUR An interval defining a period of time in days and hours
INTERVAL DAY TO MINUTE An interval defining a period of time in days, hours and
INTERVAL DAY TO SECOND An interval defining a period of time in days, hours, minutes and
seconds
INTERVAL HOUR An interval defining a period of time in hours
INTERVAL HOUR TO An interval defining a period of time in hours and minutes
MINUTE
INTERVAL HOUR TO An interval defining a period of time in hours, minutes and seconds
SECOND
INTERVAL MINUTE An interval defining a period of time in minutes
INTERVAL MINUTE TO An interval defining a period of time in minutes and seconds
SECOND
INTERVAL MONTH An interval defining a period of time in months
INTERVAL SECOND An interval defining a period of time in seconds
INTERVAL YEAR An interval defining a period of time in years
INTERVAL YEAR TO MONTH An interval defining a period of time in years and months
JSON (JavaScript Object Notation) text-based, data interchange format used
in web applications to transmit data
NUMERIC Numeric data such as integers, real numbers, and floating-point
numbers.

Teradata Studio User Guide, Release 16.00 241


Chapter 8: Data Import and Export
About Smart Load Wizard (Teradata, Aster)

Teradata Data Type Description


PERIOD(DATE) A period of dates consisting of year/month/day. (This type is available
only for Teradata 13 and later.)
PERIOD(TIME) A period of times consisting of hour/minute/second/fractional second.
(This type is available only for Teradata 13 and later.)
PERIOD(TIME WITH TIME A PERIOD(TIME) with displacements from UTC. (This type is
ZONE) available only for Teradata 13 and later.)
PERIOD(TIMESTAMP) A period of timestamps consisting of year/month/day/hour/minute/
second/fractional second. (This type is available only for Teradata 13
and later.)
REAL Floating-point data type. No additional options.
SMALLINT 16-bit binary integer. There are no additional options to enter.
TEXT In Size type the limit of the text size.
TIME A time consisting of hour/minute/second/fractional second
TIME WITH TIME ZONE A TIME with a displacement from UTC
TIMESTAMP A timestamp consisting of year/month/day/hour/minute/second/
fractional second
TIMESTAMP WITH TIME A TIMESTAMP with a displacement from UTC
ZONE
VARBYTE Variable length binary string
VARCHAR Variable length character string
XML (Extensible Markup Language) text-based, data format used for
application integration to format messages passed between
applications and as a document format for storing data

Smart Load Data Types for Aster Tables


The following data types are supported in the Smart Load Wizard for Aster tables.

Aster Option Description


BYTEA Variable-length binary string
CHAR Fixed length character string. In Size type the size limit of the
character string.
DATE A calendar date consisting of year/month/day
DOUBLE PRECISION Double-precision Floating-point number. There are no additional
options.
INTEGER 32-bit binary integer. There are no additional options.
INTERVAL There are no additional options.

242 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
About Smart Load Wizard (Hadoop)

Aster Option Description


IP4 IP address
IP4Range Range of IP addresses
NUMERIC Numeric data such as integers, real numbers, and floating-point
numbers. An Aster Database numeric must have a scale and precision
to be exported, due to the different meanings of precision and scale in
different systems. In Precision, type the total count of significant digits
in the whole number, that is, the number of digits to both sides of the
decimal point. In Scale, type the count of decimal digits in the
fractional part, to the right of the decimal point. For example, the
number 23.5141 has a precision of 6 and a scale of 4.
SMALLINT Signed two-byte integer. There are no additional options to enter.
TEXT Stores strings of any length. In Size type the limit of the text size.
TIME A time consisting of hour/minute/second/fractional second
TIME WITH TIME ZONE A TIME with a displacement from UTC
TIMESTAMP A timestamp consisting of year/month/day/hour/minute/second/
fractional second
TIMESTAMP WITH TIME A TIMESTAMP with a displacement from UTC
ZONE
UUID Stores Universally Unique Identifiers (UUID) as defined by RFC 4122,
ISO/IEC 9834-8:2005, and related standards.
VARBIT Variable length binary string
VARCHAR Variable length character string

About Smart Load Wizard (Hadoop)


The Smart Load Wizard enables you to create Hadoop tables derived from data stored in an external file.

Teradata Studio User Guide, Release 16.00 243


Chapter 8: Data Import and Export
About Smart Load Wizard (Hadoop)

Input File
Enter the path and name for the file to import or click Browse to find a file on your file system.
File Type
This is Delimited Text for Hadoop destinations.
Column Labels in First Row
Select to specify that the first row in the file contains the column labels so that the first row in the file is
ignored. This option is not available for Cloudera systems.
Column Delimiter
Specify the column delimiter used in the input file.
Line Separator
The Line Separator options enable you to import files that have only LineFeed (LF), as in Unix and
Linux, or only Carriage Return (CR) as in Mac OS/X prior to v10.0, or both, as for Windows. The
options are:
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)

244 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
About Smart Load Wizard (Hadoop)
File Encoding
Specify the type of encoding to used for the file.

Creating Tables with Smart Load (Hadoop)


Use this procedure to create a new Hadoop table by importing data from an external file.
1. In Data Source Explorer right-click Tables on a Hadoop system.
2. Select Hadoop > Data Transfer.
The Data Transfer Wizard displays.
3. In Source Type, select External File (Smart Load).
4. Click Launch.
The Smart Loader for Hadoop Wizard opens.
5. In Input File, type the directory path and name of the file that contains data you want to use to build a
table. You can also browse to the file.
6. [Optional] Select Column Labels in First Row to specify to use the first row of data as the column
labels for the new table.
This option is not available for Cloudera systems.
7. At Column Delimiter, select the delimiter that is used to separate data in the input file.

Option Description
Comma Input file data is separated by commas (,)
Semicolon Input file data is separated by semicolons (;)
Space Input file data is separated by blank spaces
Tab Input file data is separated by Tabs
8. In Line Separator, select one of the following options based on the operating system from which the
data is imported. This option enables you to import files with only Carriage Returns (CR), only
LineFeeds (LF), or both Carriage Returns and LineFeeds (CR and LF).
• Windows OS (CR and LF)
• Prior to Mac OS X v10.0 (CR)
• Unix, Linux, Mac OS X v10.0 and above (LF)
9. In File Encoding select the character set to use to encode the data.
The options are: UTF-8, UTF-16, ISO-8859-1, UTF-16BE, UTF-16LE, US-ASCB, Cp1252.
10. Click Next.
The Hadoop Table Properties screen displays.
11. In Table Name, type the name of the table to be derived from the loaded data.
12. In Table File Format, select the format of the data in the table.
Supported table file format types are TEXT (default), SEQUENCE, RC, and ORC. ORC is only
available for Hortonworks.
For Cloudera Systems, if RC or SEQUENCE is selected for Table File Format, the wizard requires
Hive JDBC Properties.

Teradata Studio User Guide, Release 16.00 245


Chapter 8: Data Import and Export
About Smart Load Wizard (Hadoop)
Note:
The hive host name field is prepopulated with the impala host name. If the hive host name is
different, modify the field to the correct host value.
13. To edit the data types of a specific column, click (ellipses) in the column header.
14. Select one of the following:

Option Description
Click Next Previews the SQL/DDL code that creates the new table. You can edit the SQL
statements in the Generated SQL text area by clicking Show in Editor. If you choose
to open the SQL Editor, the Smart Load Wizard closes. You can run the SQL query
statements from the SQL Editor to create the table.
Click Finish Creates the table and imports the data from the file.

Editing Column Data Types (Hadoop)


You can edit the data type for a table column prior to importing data in the Smart Load Wizard. The exact
menu options vary depending on the table type and the column type.

1. On the Data Types page, click the ellipsis next to the data type to change.
2. In Type select the data type for the column you are editing.
3. Click OK.

Smart Load Data Types for Hadoop Tables


The following data types are supported in the Smart Load Wizard for Hadoop tables.

Teradata Data Type Description


BIGINT 8-byte binary integer. There are no additional options.
DATE A date consisting of year/month/day. This does not apply to Cloudera
systems.
DOUBLE Floating-point data type. There are no additional options.

246 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Export External Data

Teradata Data Type Description


FLOAT Floating point number
INT 32-bit binary integer. There are no additional options.
SMALLINT 16-bit binary integer. There are no additional options.
STRING Character string.
TIMESTAMP A timestamp consisting of year/month/day/hour/minute/second/
fractional second.
Cloudera systems can also use year/month/day.
TINYINT 8-bit binary integer. There are no additional options.

Export External Data

About the Export Data Wizard


The Export Data Wizard enables you to export data from a table to a file in a file system.

Export Data to External File


In this section you can specify the name of the file to receive the data and the server path to its location
in the file system. To locate an existing file, click Browse and navigate the file system to select a file. You
can choose to export data to a text file, such as a .txt or .csv file, or to a Microsoft Excel file. Choose

Teradata Studio User Guide, Release 16.00 247


Chapter 8: Data Import and Export
Transfer Progress View
between a .xslx file, or .xls (Microsoft Excel 97-2003) file. The file data options change depending on
which type of output file you select.
Table Column Option
Selecting Select Column Labels in First Row retrieves the column headers in the table to be written as
the column labels in the first row of data in the export file.
Export File Delimiters and Encoding
A delimiter is a character or sequence of characters that specify the boundaries of independent
regions of data in plain text by distinguishing the beginning and end of the unit of data, such as a field
value. You must select how you want to delimit data from exported table columns when it is imported to
the target file. You can accept the default to use commas or you can use choose to use semicolons,
spaces, tabs, or vertical bars (|). You can optionally select delimiters for character strings and the type of
file encoding to use.
Controls
Control buttons are used to move forward or backward within the Export Data Wizard. When you are
ready to export data, click Finish. A Progress Information dialog displays to show the progress of the
export task.

Exporting Table Data to an External File


You can select a database table in the Data Source Explorer and export the data in the table to a TXT, CSV,
XSL, or XSLX file in your file system. When you select to export data to an external file, the Export Data
Wizard opens and prompts you for information about the data transfer operation.
1. Select a table object in the Data Source Explorer to use as the source table for exporting data to a file.
2. Right-click the selected table object and select Data > Export Data.
3. In the Data Transfer Wizard, select External File (FastExport) as the Destination Type.
The Export Data Wizard opens.

Transfer Progress View

About the Transfer Progress View


The Transfer Progress View displays a list of executing data transfer jobs and their status. It provides
information about the source and destination tables for the data transfer, name of the transfer job, and start
time, as well as the current elapsed time for the transfer operation. A progress bar appears in the right-most
column for each executing job and shows the current progress state of the transfer compared to the
estimated length of time to completion.
The Transfer Progress View runs a single job to completion before it starts the next job. If multiple jobs are
submitted at the same time, the jobs are placed in a queue and run in sequence.
If you close Teradata Studio while jobs are running or queued, the jobs are canceled. Canceled jobs are
moved to the History View where you can re-execute the jobs at a later time. If you close the view and need
to re-open it, go to Window > Window > Transfer Progress View. The Transfer Progress View
automatically displays when you select the Data Transfer perspective.

248 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Transfer Progress View

List of Transfer Jobs


The view displays a list of the data transfer jobs that are currently executing. After a job completes, you
can view the transfer report in the Transfer History View and re-execute the job if needed.
Job Information
The view provides the following details for each data transfer job.
Menu Description
Job Type Indicates the system type (Aster, Hadoop, or Teradata) and the type of
transfer job; for example, whether the job is an Aster Load, Teradata Table
Copy, Import from Hadoop to Teradata, or Export from Teradata to
Hadoop.
Name Displays the name which can be changed before the job begins in the setup
wizard or after the job has completed in the Transfer History View. By
default, the name of the job is the job type followed by the name of the table
that is being transferred.
Start Time Displays the time stamp for the start of the data transfer operation.
Time Elapsed Displays how long the job has been running. The entry displays
"CANCELING" if the transfer is in the process of being canceled. The
elapsed time value is updated continuously until the transfer completes.
Summary Displays the names of the source and destination tables for the transfer job.
Progress When a transfer job is running, the Progress bar shows the percentage of
completion by displaying a green bar that gradually expands in length as the
job progresses.

Progress Bar
The view displays a list of the data transfer jobs that are currently executing. After a job completes, it
becomes an entry in the Transfer History View .
Queue List
Transfer jobs run one at a time. If a job is already running, the next job request is placed in the queue
and designated as "queued" in the Progress column.
Toolbar
The Transfer Progress View toolbar allows you to cancel any jobs that are running and to view
additional details about a job in the view list.

Teradata Studio User Guide, Release 16.00 249


Chapter 8: Data Import and Export
Transfer Progress View

Icon Menu Description


Cancel Cancels the selected job in progress. The canceled job displays in
the Transfer History View.
Transfer Details Opens the Transfer Details dialog that displays the output from
the transfer job while it is running. After the job completes, the
output is available in the Transfer History View.

Transfer Details
The Transfer Details dialog displays the output of the transfer operation while the job is running.

After the job completes, you can view the output in the Transfer History View.

Job Details
The Job Details dialog displays the output of the transfer operation while the job is running. After the job
completes, you can view the output in the Transfer History View.

250 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Transfer History View

Transfer History View

About the Transfer History View


The Teradata Transfer History view provides an enhanced display of the Data Transfer History
information in the database. As data transfers are performed, an entry is placed in the Transfer History. The
Transfer History view displays the data in a grid format that enables you to select rows or cells.
The Transfer History view provides extensive information about the data transfer event, such as the name,
start time, rows transferred, source and destination systems, status (Completed, Canceled, or Failed), and
summary. It provides options to:
• Copy selected cells to the clipboard
• Sort columns
• Delete rows
• Edit "Note" or "Name" for a history entry
• Filter columns
• Search for transfer history data
• Hide and show columns
• Auto-resize columns or rows
• Display the job output for a History entry
The Transfer History view uses an embedded Derby Database to manage the Transfer History entries.

If you close the view, select Window > Show View > Transfer History View to reopen the view.
You can add notes manually by selecting the Transfer History View Note entry and in the toolbar clicking
Edit Note. In the Transfer History Note dialog, type the note you want added to the Transfer History
View entry.
All columns are sortable in ASC/DSC order with the exception of the parameters column. The columns are
sorted by left clicking the mouse button. This is for single column sorting only.
Columns are movable by selecting the column and dragging it to the new location. Columns are also re-
sizable. Rows can be selected by clicking in the numbered row header.
If a filter is in effect, the result of a newly executed data transfer is inserted at the top row, regardless of
whether it meets the filter criterion. If a sort is in effect the new entry is inserted in the sorted order.
The Summary column contains a brief summary of the data transfer, such as the source database and table
names. The Job Output can be displayed by selecting the history entry and clicking Show Job Output in the
toolbar. Failed data transfers display as red text in the Status column.

Toolbar Actions

Icon Option Description


Edit name Click to edit the name of the transfer history entry.

Edit note Click to edit the note field of the transfer history entry.

Delete selected Click to delete selected row(s) from the view and transfer history
row(s) database.

Teradata Studio User Guide, Release 16.00 251


Chapter 8: Data Import and Export
Transfer History View

Icon Option Description


Filter display Click to open a dialog to filter display.

Clear filter Click to clears the filter and refresh the transfer history display.

Show job output Click to show the job output.

Toolbar Menu

Icon Option Description


Edit Name Click to edit the name of the transfer history entry.

Edit Note Click to edit the note of the transfer history entry.

Delete Selected Click to delete selected row(s) from the view and transfer history
Row(s) database.
Delete All Transfer Click to delete all entries in the transfer history database.
History
Filter Click to open a dialog to Filter display.

Clear Filter Click to remove the current filter from the display.

Reexecute Click to execute the selected data transfer job in the Transfer History
list.
Show Transfer Job Click to display the job output for the selected data transfer job.
Output

Column Headers

Column Name Description


Name Name of the transfer job.
Timestamp Time of transfer event. Format is yyyy-mm-dd
hh:mm:ss.mm.
Source Profile name for database that was the data source
for the transfer.
Destination Profile name of the database to which the data was
transferred.
Status Status of the transfer event.
Duration Length of time required to transfer data between the
source and destination. The format is hh:mm:ss.mm.
Rows Transferred Number of table rows transferred.
Note Text notes about transfer event.
Summary Technical summary describing transfer source and
destination paths.

252 Teradata Studio User Guide, Release 16.00


Chapter 8: Data Import and Export
Transfer History View
Column Header Context Menu
Right-click a column header to hide, show, and resize columns. You can also use the Find feature to locate
data in column rows.
Icon Option Description
Hide column Hides the current column.

Show all columns Shows all columns.

Auto resize column Resizes the current column.

Find Displays the Find dialog to search rows in the column for a value. -
Searches the Transfer History View for a value.

Transfer History Filter


The Transfer History Filter dialog enables you to filter rows in the transfer history view. Only rows meeting
the filter criterion are displayed.

Note:
New data transfers appear regardless of whether or not they meet the filter criterion.

There are three types of filter criterion:


• LIKE, where '_' matches a single character, '%' matches 0 or more characters, like using abc% to filter
values that start with 'abc'
• EQUALS (=), which is equals match
• Less than, equal, greater than(<, =, >), which is a less than, equals, or greater than match
• Selection, which is a list selection match.
The dialog contains the following elements:
Element Description
Name Filters on the Name column. This is a "LIKE" filter.
Timestamp Filters on the Date portion of the Timestamp column. There are two options. If "day's"
is selected, the indicated number of days history is displayed. "1" indicates the current
day, "2" indicates today and the day before. If the "day's" check box is cleared, choose
the operation, "<, =, >" and choose the date.
Source Filters on the Source column. This is a "LIKE" filter.
Destination Filters on the Destination column. This is a "LIKE" filter.
Status Filters on the Status column. Choose from the selection list Completed, Canceled, or
Failed.
Duration Filters on the Duration column. This is a less than, equal, greater than filter.
Rows Filters on the Rows Transferred column. This is a less than, equal, greater than filter.
Transferred
Note Filters on the Note column. This is a "LIKE" filter.

Teradata Studio User Guide, Release 16.00 253


Chapter 8: Data Import and Export
Transfer History View

Element Description
Summary Filters on the Summary column. This is a "LIKE" filter.

Sort
The Sort dialog enables you to perform multi-column sorting. Select columns from the Columns list and
move them to the list of columns to be sorted. Use the sort direction to move columns from and to lists. If a
subsequent single column sort is made by clicking a column header, the multi-column sort is removed.

254 Teradata Studio User Guide, Release 16.00


CHAPTER 9
Troubleshooting

Troubleshooting
Teradata Error Log
The Teradata error log, teradata.log, is located in the user workspace .metadata/Teradata directory.
Log messages are sent to the teradata.log file as well as to the Teradata Log console. To display the
Teradata Log console, first you need to open the Console View. From the main menu, select Window >
Show Views > Other. Then select General > Console and click OK. The Console View opens at the bottom
of the screen. From the Console View toolbar you can open the Teradata Log console by clicking the down
arrow icon and selecting TeradataLog.

Eclipse Error Log


Eclipse provides an error log to display any Eclipse error messages. Display this view by selecting Window >
Show View and selecting Error Log.

Turning on Debug
You can configure the level of logging desired via the Teradata Logging Preferences page. Logging levels
for the Teradata Log console and the Teradata log file are controlled separately. For example, you can change
the logging level for the Teradata log file by clicking the DEBUG button under the Datatools Logging
Level, then clicking Apply. This action enables debug logging for all of Teradata Studio plug-ins, with log
messages going to the teradata.log file.
You can also add a Logger for more localized logging. For example, you can log debug messages for only the
com.teradata.datatools.dtp.catalog plug-in. Here are the steps for turning on the debug logging
level:
1. Click the Loggers New button.
2. Enter the name of the plug-in, such as com.teradata.datatools.dtp.catalog.
3. Select com.teradata.datatools.dtp.catalog in the Loggers list and choose the logging level,
such as DEBUG.
4. Click Apply.

Teradata Studio User Guide, Release 16.00 255


Chapter 9: Troubleshooting
Troubleshooting

This enables debug message logging for the com.teradata.datatools.dtp.catalog plug-in, with
log messages going to the teradata.log file. You can add additional plug-ins to the list and configure
each with its own logging level.

256 Teradata Studio User Guide, Release 16.00