Sunteți pe pagina 1din 350

What would you do if you knew?

Teradata Studio
User Guide
Release 15.10
B035-2041-045K
April 2015
The product or products described in this book are licensed products of Teradata Corporation or its affiliates.

Teradata, Active Data Warehousing, Active Enterprise Intelligence, Applications-Within, Aprimo Marketing Studio, 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.
AMD Opteron and Opteron are trademarks of Advanced Micro Devices, Inc.
Apache, Apache Hadoop, 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.
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.
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 2015 by Teradata. All Rights Reserved.
Table of Contents

Preface...........................................................................................................................................................19

Purpose................................................................................................................................................................ 19
Audience.............................................................................................................................................................. 19
Revision History................................................................................................................................................. 19
Additional Information..................................................................................................................................... 19
Related Documents..................................................................................................................................... 19
Product Safety Information...............................................................................................................................19

Chapter 1:
Overview..................................................................................................................................................... 21

About Teradata Studio....................................................................................................................................... 21


Teradata Studio Key Features............................................................................................................................21
Key Studio Features.....................................................................................................................................21
Key Studio Interface Components............................................................................................................ 22

Chapter 2:
Teradata Studio Basics................................................................................................................. 25

Getting Started.................................................................................................................................................... 25
Launching Studio Workbench................................................................................................................... 25
Setting Up Your Workspace....................................................................................................................... 25
Changing Workspace Locations on Linux........................................................................................26
Changing Workspace Locations on MacIntosh............................................................................... 26
Changing Workspace Locations on Windows..................................................................................26
Getting Started With Teradata Studio.......................................................................................................26
Exiting Studio Workbench......................................................................................................................... 26
Teradata Studio Interface...................................................................................................................................27
Studio Workbench.......................................................................................................................................27
Customizing the Display..................................................................................................................... 28
Studio Views................................................................................................................................................. 28
Teradata Studio Views..........................................................................................................................28
Opening Views......................................................................................................................................29
Moving View Panels............................................................................................................................. 30

Teradata Studio User Guide, Release 15.10 3


Table of Contents

Studio Toolbars............................................................................................................................................. 30
Studio Preferences........................................................................................................................................ 31
Teradata Studio Preferences.................................................................................................................31
Data Management Preferences.....................................................................................................31
General Preferences....................................................................................................................... 32
Help Preferences.............................................................................................................................32
Teradata Datatools Preferences.................................................................................................... 32
Setting Preferences................................................................................................................................ 33
Teradata Studio Perspectives..............................................................................................................................33
Teradata Administrator Perspective...........................................................................................................34
Opening the Teradata Administrator Perspective............................................................................ 34
Query Development Perspective................................................................................................................ 35
Toolbar for Query Development......................................................................................................... 36
Actions.............................................................................................................................................36
Opening the Query Development Perspective..................................................................................36
Data Transfer Perspective............................................................................................................................37
Opening the Data Transfer Perspective..............................................................................................37
Database Development Perspective........................................................................................................... 38
Opening the Database Development Perspective............................................................................. 38

Chapter 3:
Database Connectivity....................................................................................................................39

About Connection Profiles.................................................................................................................................39


Supported Database Connection Profiles........................................................................................................ 39
New Profile Connection Types Preferences..................................................................................................... 39
Active connection types for new profile dialog........................................................................................ 39
Teradata Database Connectivity........................................................................................................................40
Teradata Connection Profiles..................................................................................................................... 40
Creating a Teradata Connection Profile.............................................................................................40
Driver Definitions.........................................................................................................................................42
Adding a New Teradata Driver Definition.........................................................................................42
JDBC Connection Properties......................................................................................................................42
Adding a JDBC Property......................................................................................................................42
Database Cache.............................................................................................................................................43
Database Cache Inheritance................................................................................................................ 43
Progress Monitor................................................................................................................................... 43
About Refreshing Cache.......................................................................................................................43
Termination of Cache Job.................................................................................................................... 44
QueryBand Preferences............................................................................................................................... 44
Control query band settings................................................................................................................ 44
Aster Database Connectivity..............................................................................................................................44

4 Teradata Studio User Guide, Release 15.10


Table of Contents

About Connection Profiles for Aster Database....................................................................................... 44


Aster Database Connection Properties............................................................................................. 45
Connection Properties................................................................................................................. 45
JDBC Connection Properties...................................................................................................... 45
Property Actions........................................................................................................................... 45
Connection Actions...................................................................................................................... 46
Creating an Aster Database Connection Profile..............................................................................46
Connecting to an Aster Database...................................................................................................... 48
Disconnecting From Aster Database.................................................................................................48
Deleting an Aster Connection Profile............................................................................................... 48
Adding and Editing JDBC Connection Properties.................................................................................49
Adding an Aster Database Driver Definition.......................................................................................... 49
New JDBC Property.............................................................................................................................50
New JDBC Property Name and Value........................................................................................50
Actions............................................................................................................................................50
Add a JDBC Property.......................................................................................................................... 50
JDBC Properties............................................................................................................................ 51
Actions............................................................................................................................................51
About Caching Aster Schemas.................................................................................................................. 51
Caching Aster Schemas....................................................................................................................... 52
Schema Cache Properties....................................................................................................................52
Cache Properties Options............................................................................................................ 52
Actions............................................................................................................................................53
Editing Aster Cache Schema Properties............................................................................................53
About Refreshing Schema Cache....................................................................................................... 53
Deleting Aster Cache Files.................................................................................................................. 54
Hadoop Connectivity.........................................................................................................................................54
Creating a Hadoop Generic System Connection Profile....................................................................... 54
Hadoop Hortonworks Connection Profiles.............................................................................................55
Creating Hadoop Hortonworks Connection Profiles Using Knox Gateway............................... 55
Creating Hadoop Hortonworks Connection Profiles Using TDCH............................................. 57
Creating Hadoop Hortonworks Connection Profiles Using JDBC............................................... 59
Creating Hadoop Hortonworks Connection Profiles Using SQL-H.............................................61
Foreign Servers................................................................................................................................................... 63
Foreign Server Form................................................................................................................................... 63
Creating a Foreign Server...........................................................................................................................64
Altering Foreign Server Properties........................................................................................................... 65
Dropping a Foreign Server.........................................................................................................................67

Chapter 4:
Teradata Studio Workbench.................................................................................................... 69

Teradata Studio User Guide, Release 15.10 5


Table of Contents

Project Explorer................................................................................................................................................... 69
Data Source Explorer.......................................................................................................................................... 69
Data Source Explorer Load Preferences.................................................................................................... 69
What to Load......................................................................................................................................... 70
What to Display..................................................................................................................................... 70
Load Object Details...............................................................................................................................70
Actions.................................................................................................................................................... 71
Setting Data Source Explorer Load Preferences.......................................................................................71
Loading Teradata Databases to Data Source Explorer............................................................................ 72
Removing Teradata Databases in Data Source Explorer.........................................................................73
Setting Root of Data Source Explorer Display..........................................................................................73
Object Viewer....................................................................................................................................................... 73
About the Object Viewer..............................................................................................................................73
Opening the Object Viewer..................................................................................................................75
Sorting in Object Viewer...................................................................................................................... 75
Filtering Object Views...........................................................................................................................75
Toolbar for Object Viewer.................................................................................................................... 76
Actions.............................................................................................................................................76
Setting Object Viewer Preferences...................................................................................................... 78
About Viewing Objects................................................................................................................................ 78
Viewing Objects in a Database............................................................................................................ 79
Databases View........................................................................................................................79
Toolbar.............................................................................................................................. 80
Indexes View............................................................................................................................ 80
Toolbar.............................................................................................................................. 80
Macros Tab...............................................................................................................................81
Toolbar.............................................................................................................................. 81
Stored Procedures View..........................................................................................................82
Toolbar.............................................................................................................................. 82
Tables View...............................................................................................................................83
Toolbar.............................................................................................................................. 83
User-Defined Functions View............................................................................................... 84
User-Defined Function Types Actions..........................................................................84
Views View............................................................................................................................... 85
Toolbar.............................................................................................................................. 85
Viewing Object Details......................................................................................................................... 86
Database Object Tab...............................................................................................................86
User Information Tab...................................................................................................... 86
Tables Tab..........................................................................................................................86
Macros Tab........................................................................................................................87
Procedures Tab................................................................................................................. 87
Indexes Tab....................................................................................................................... 88
Jars Tab.............................................................................................................................. 88

6 Teradata Studio User Guide, Release 15.10


Table of Contents

UDFs Tab......................................................................................................................... 88
Privileges Tab...................................................................................................................89
Systems Rights Tab......................................................................................................... 89
Query Logging Tab.........................................................................................................89
Access Logging Tab........................................................................................................ 90
Rights Held By Tab......................................................................................................... 90
Column Rights Tab.........................................................................................................90
Stored Procedure Object Tab................................................................................................91
Parameters....................................................................................................................... 91
Details...............................................................................................................................91
SQL................................................................................................................................... 92
Privileges.......................................................................................................................... 92
Users................................................................................................................................. 92
Macro Object Tab...................................................................................................................92
Parameters Tab................................................................................................................92
Details Tab....................................................................................................................... 93
SQL Tab............................................................................................................................93
Privileges Tab...................................................................................................................93
Users Tab..........................................................................................................................93
Table Object Tab.....................................................................................................................93
Columns Tab...........................................................................................................................94
Details Tab.............................................................................................................................. 95
Indexes Tab............................................................................................................................. 96
Constraints Tab...................................................................................................................... 96
Triggers Tab............................................................................................................................ 98
Space Use Tab......................................................................................................................... 98
SQL Tab................................................................................................................................... 99
Privileges Tab..........................................................................................................................99
References Tab........................................................................................................................99
Statistics Tab........................................................................................................................... 99
Users Tab...............................................................................................................................100
Column Rights Tab..............................................................................................................100
UDF Object Tab................................................................................................................... 100
Parameters Tab..............................................................................................................100
Details Tab..................................................................................................................... 101
SQL................................................................................................................................. 101
Source.............................................................................................................................101
Privileges Tab................................................................................................................ 101
User.................................................................................................................................101
View Object Tab................................................................................................................... 101
Columns Tab................................................................................................................. 101
Details Tab..................................................................................................................... 102
SQL Tab..........................................................................................................................102

Teradata Studio User Guide, Release 15.10 7


Table of Contents

Privileges Tab..................................................................................................................102
References Tab................................................................................................................102
Users Tab.........................................................................................................................103

Chapter 5:
Administration of Teradata Databases ...................................................................... 105

Data Utilities.......................................................................................................................................................105
Data Utilities Preferences.......................................................................................................................... 105
Disk Cache........................................................................................................................................... 105
Actions.................................................................................................................................................. 105
Administration Dialogs.................................................................................................................................... 106
Administer Profiles.................................................................................................................................... 106
Administer Profile Tabs......................................................................................................................106
About User Profiles............................................................................................................................. 106
Required Privileges............................................................................................................................. 106
About Dropping a User Profile..........................................................................................................106
General..................................................................................................................................................107
Users In Profile.................................................................................................................................... 107
Password............................................................................................................................................... 108
SQL Preview.........................................................................................................................................109
Create Authorization................................................................................................................................. 110
Display Authorization Tab................................................................................................................. 110
Set Authorization Tab......................................................................................................................... 110
Grant, Revoke, or Display System Rights................................................................................................111
Grant/Revoke Tab............................................................................................................................... 111
SQL Preview Tab................................................................................................................................. 112
Display Tab...........................................................................................................................................112
Grant Tab..............................................................................................................................................112
Revoke Tab........................................................................................................................................... 113
SQL Preview Tab................................................................................................................................. 113
Display, Grant, and Revoke Privileges..................................................................................................... 114
Grant/Revoke Tab............................................................................................................................... 114
SQL Review Tab...................................................................................................................................115
Display Tab ..........................................................................................................................................115
Grant Tab..............................................................................................................................................116
Revoke Tab........................................................................................................................................... 116
Grant, Revoke, or Display Column Rights..............................................................................................117
Grant/Revoke Tab............................................................................................................................... 117
SQL Preview.........................................................................................................................................118
Display Tab...........................................................................................................................................118
Grant Tab..............................................................................................................................................118

8 Teradata Studio User Guide, Release 15.10


Table of Contents

Revoke Tab.......................................................................................................................................... 119


SQL Preview Tab................................................................................................................................ 120
Connect Through Rights.......................................................................................................................... 120
Grant/Revoke Tab.............................................................................................................................. 120
SQL Preview........................................................................................................................................121
Permanent Proxy Users Tab..............................................................................................................121
Application Proxy Users Tab............................................................................................................ 121
Display Tab..........................................................................................................................................122
Revoke Tab.......................................................................................................................................... 122
SQL Preview Tab................................................................................................................................ 122
Logon Rights.............................................................................................................................................. 123
Grant/Revoke Tab.............................................................................................................................. 123
SQL Review Tab................................................................................................................................. 124
Display Tab..........................................................................................................................................124
Grant Tab.............................................................................................................................................124
Revoke Tab.......................................................................................................................................... 124
SQL Preview Tab................................................................................................................................ 125
Move Space.................................................................................................................................................125
Access Logging Rules................................................................................................................................126
Display Access Logging Tab..............................................................................................................126
Set Access Logging Tab......................................................................................................................127
Query Logging Rules................................................................................................................................ 128
Display Query Logging Rules...........................................................................................................128
Rule Type......................................................................................................................................128
Logging Rules.............................................................................................................................. 129
Set Query Logging Tab...................................................................................................................... 129
Rule Type......................................................................................................................................129
What to Log................................................................................................................................. 129
Limits............................................................................................................................................ 130
Teradata Database Administration................................................................................................................ 131
Administer Roles....................................................................................................................................... 131
Administer Roles Tabs.......................................................................................................................131
About Roles.........................................................................................................................................131
About Role Types............................................................................................................................... 131
Required Privileges............................................................................................................................ 132
About Dropping a Default Role....................................................................................................... 132
User Member Attributes Tab............................................................................................................ 132
User Members Tab............................................................................................................................. 132
Role Members Tab............................................................................................................................. 133
SQL Preview Tab................................................................................................................................ 133
Aster Database Administration...................................................................................................................... 134
Aster Databases and Privileges................................................................................................................134
Changing Privileges on Aster Databases.........................................................................................134

Teradata Studio User Guide, Release 15.10 9


Table of Contents

Changing Privileges on Schemas...................................................................................................... 135


Changing Privileges on Aster Views................................................................................................. 136
Granted Privileges............................................................................................................................... 137
Grantee Type and Privileges.............................................................................................................. 137
Aster Databases, Users, and Roles.....................................................................................................138
User Form.............................................................................................................................. 138
Creating an Aster Database User........................................................................................ 139
Changing Privileges and Roles for an Aster User............................................................. 141
Aster Database Roles and Membership...................................................................................................142
Role Form.............................................................................................................................................142
Creating an Aster Role........................................................................................................................143
Changing Privileges and Roles on Aster Roles................................................................................145
Dropping an Aster Role......................................................................................................................146

Chapter 6:
Development of Teradata Databases............................................................................ 149

Database Objects Search...................................................................................................................................149


Find Object..................................................................................................................................................149
Find Object...........................................................................................................................................149
Find Next.............................................................................................................................................. 149
Advanced Find Objects..............................................................................................................................150
Advanced Find Results....................................................................................................................... 151
Find Results................................................................................................................................................. 152
Data Definitions Generation............................................................................................................................152
Generate DDL Basics................................................................................................................................. 152
Generating DDL Dialog............................................................................................................................ 152
Displaying DDL Statements......................................................................................................................153
Generating DDL for Teradata Objects.....................................................................................................154
Generating DDL for Aster Objects.......................................................................................................... 155
Teradata Database Development.....................................................................................................................157
Create Database.......................................................................................................................................... 157
Modify Database.........................................................................................................................................157
Create User Wizard.....................................................................................................................................157
Modify User.................................................................................................................................................158
Clone User................................................................................................................................................... 158
Create Table.................................................................................................................................................159
Create View..................................................................................................................................................159
Create/Modify View................................................................................................................................... 160
Create Trigger............................................................................................................................................. 160
Create Macro...............................................................................................................................................161

10 Teradata Studio User Guide, Release 15.10


Table of Contents

Create Stored Procedure...........................................................................................................................161


Create User-Defined Function................................................................................................................ 162
Create Structured User-Defined Type....................................................................................................163
Create Distinct User-Defined Type........................................................................................................ 163
Create Array User-Defined Type............................................................................................................ 164
Edit Comments Dialog............................................................................................................................. 164
Drop Confirmation................................................................................................................................... 164
Teradata Database Browsers........................................................................................................................... 165
Dependency Browser................................................................................................................................165
Dependencies Preferences................................................................................................................ 165
Interdependency Browser........................................................................................................................ 165
Interdependency Browser Actions...................................................................................................166
Interdependency Printing................................................................................................................. 167
Meta Data Services Synchronization Issues...........................................................................................168
Synchronizing New Objects Added to the Database System....................................................... 168
Loading Teradata System into the Meta Data Services Repository.............................................168
Aster Database Development..........................................................................................................................168
Browsing Aster Schemas and Objects.................................................................................................... 168
Defining Databases on an Aster Server..................................................................................................168
Database Form....................................................................................................................................168
Creating an Aster Database.............................................................................................................. 169
Naming an Aster Database............................................................................................................... 171
Dropping an Aster Database............................................................................................................ 171
Defining Aster Schemas........................................................................................................................... 171
Creating an Aster Schema.................................................................................................................171
Schema Form...................................................................................................................................... 172
Dropping an Aster Schema............................................................................................................... 173
Defining Aster Database Users................................................................................................................174
Creating an Aster Database User..................................................................................................... 174
User Form............................................................................................................................................175
Dropping an Aster Database User................................................................................................... 176
Defining Aster Roles................................................................................................................................. 176
Creating an Aster Role.......................................................................................................................176
Role Form............................................................................................................................................178
Dropping an Aster Role.....................................................................................................................179
Defining Aster Tables................................................................................................................................179
Aster Analytic Tables and Persistence............................................................................................. 179
Creating an Aster Table..................................................................................................................... 180
Table Form.......................................................................................................................................... 183
Dropping an Aster Table................................................................................................................... 184
Aster Table Types............................................................................................................................... 185
Defining Aster Views.................................................................................................................................185

Teradata Studio User Guide, Release 15.10 11


Table of Contents

Creating an Aster View....................................................................................................................... 185


View Form............................................................................................................................................ 187
Dropping an Aster View..................................................................................................................... 187

Chapter 7:
Teradata Data Labs..........................................................................................................................189

About the Data Lab View..................................................................................................................................189


Opening the Data Lab View...................................................................................................................... 190
Copying Tables to Data Labs.................................................................................................................... 191
Data Lab Copy Wizard......................................................................................................................................192
About the Data Lab Copy Wizard............................................................................................................ 192
About Copy Table.......................................................................................................................................192
About Filter Table....................................................................................................................................... 194
About SQL Preview Filter Table............................................................................................................... 195

Chapter 8:
Query Development.........................................................................................................................197

Data Tools for Query Development................................................................................................................ 197


SQL Editor Preferences..............................................................................................................................197
General Tab.......................................................................................................................................... 197
Typing Tab............................................................................................................................................199
SQL Formatter Preferences................................................................................................................ 199
Teradata SQL Editor..........................................................................................................................................201
About the SQL Editor................................................................................................................................ 201
Opening a Non-Teradata or Non-Aster SQL Editor...................................................................... 202
Drag and Drop into SQL Editor........................................................................................................ 203
SQL Editor Toolbar.................................................................................................................................... 203
Connection Profile.............................................................................................................................. 203
Actions.................................................................................................................................................. 203
Execute SQL................................................................................................................................................ 204
Running SQL....................................................................................................................................... 204
Running Database Objects......................................................................................................... 204
Running SQL from Run Menu.......................................................................................................... 205
Run Configurations..................................................................................................................... 205
Using Run Configurations.......................................................................................................... 205
Run last.......................................................................................................................................... 206
Automatically Created Run Configurations.............................................................................206
Format SQL Command............................................................................................................................. 206

12 Teradata Studio User Guide, Release 15.10


Table of Contents

Set Connection Information....................................................................................................................206


SQL Editor Templates............................................................................................................................... 206
Retrieving Table Rows using a SELECT Template.........................................................................207
Inserting Table Rows using an INSERT Template......................................................................... 207
Inserting Table Rows using Parameterized Queries......................................................................208
Parameterized Queries........................................................................................................209
Named Parameters....................................................................................................... 209
Reexecuting Parameterized Queries.......................................................................... 209
Updating Table Rows using an UPDATE Template...................................................................... 209
Deleting Table Rows using a DELETE Template........................................................................... 210
Inserting Aster Analytical Functions...............................................................................................210
Compare Objects.............................................................................................................................................. 211
Dependent Objects....................................................................................................................................211
Select All and Deselect All....................................................................................................................... 212
About Comparing Objects....................................................................................................................... 212
Teradata Compare Objects View......................................................................................................212
Types of Objects to Compare........................................................................................................... 212
Comparing Database and User Objects in Teradata..................................................................... 213
Comparing Table Objects in Teradata.............................................................................................215
About the Compare Editor.......................................................................................................................218
About Launching the Compare Editor............................................................................................220
Compare Editor Toolbar................................................................................................................... 220
Compare SQL Objects..................................................................................................................................... 221
Compare SQL Objects Wizard.................................................................................................................221
Select Connection Profile..................................................................................................................221
List of Teradata Database Objects....................................................................................................221
Compare-to Teradata Database........................................................................................................221
Compare-to Teradata Object............................................................................................................ 221
List of Aster Schema Objects............................................................................................................ 221
Compare-to Aster Schema Object................................................................................................... 221
About the Compare SQL Object Wizard.........................................................................................222
Result Set Viewer.............................................................................................................................................. 224
Result Set Viewer....................................................................................................................................... 224
Result Set Viewer Preferences.................................................................................................................. 227
Setting Result Set Viewer Preferences..............................................................................................229
Formatting the Foreground in Selected Cells.................................................................................231
Formatting the Background in Selected Cells................................................................................ 231
SQL Handling............................................................................................................................................ 232
Common............................................................................................................................................. 232
Teradata............................................................................................................................................... 233
Aster..................................................................................................................................................... 233
Sounds................................................................................................................................................. 233

Teradata Studio User Guide, Release 15.10 13


Table of Contents

Actions.................................................................................................................................................. 234
Setting SQL Handling Preferences....................................................................................................234
SQL History View.............................................................................................................................................. 235
SQL History View....................................................................................................................................... 235
Toolbar Actions................................................................................................................................... 236
Toolbar Menu Options....................................................................................................................... 237
Context Menu Options:......................................................................................................................237
About SQL History View........................................................................................................................... 238
Toolbar for SQL History............................................................................................................................ 239
Actions.................................................................................................................................................. 239
Filtering with Data Filter........................................................................................................................... 240
History Preferences.................................................................................................................................... 240
Exclude Options for History Database.............................................................................................240
History Rows........................................................................................................................................241
History View Columns Settings.........................................................................................................241
Actions.................................................................................................................................................. 242
Execution Plans..................................................................................................................................................242
About Comparing Execution Plans......................................................................................................... 242
Compare Graphic Execution Plans..........................................................................................................242
Execution Plan List.....................................................................................................................................242
Compare Execution Plans Tab..................................................................................................................243
Compare Step Attributes Tab....................................................................................................................243
Display Statistics Tab..................................................................................................................................243
Execution Plan List Actions...................................................................................................................... 243
Execution Plan Options.............................................................................................................................244
Graphic Comparison Actions...................................................................................................................245
Teradata Query Capture Database...........................................................................................................245
Statistics Data Actions............................................................................................................................... 246
Step Attribute Comparison Actions.........................................................................................................246
Comparison Actions.................................................................................................................................. 247
Teradata Execution Plan Preferences.......................................................................................................247
Statistics.............................................................................................................................................................. 247
Statistics Collection View.......................................................................................................................... 247
Collect Statistics Wizard............................................................................................................................ 249
Drop Statistics............................................................................................................................................. 250
Filter Operations.........................................................................................................................................251
Collect Statistics SQL Preview.................................................................................................................. 252
About Teradata SQL Query Builder................................................................................................................252

Chapter 9:
Table Data Development............................................................................................................255

14 Teradata Studio User Guide, Release 15.10


Table of Contents

About the Table Data Editor........................................................................................................................... 255


Table Data Editor..............................................................................................................................................256
Toolbar........................................................................................................................................................256
Table Data Grid......................................................................................................................................... 256
Actions on Columns................................................................................................................................. 256
Actions on Rows........................................................................................................................................ 257
Actions on Cells.........................................................................................................................................257
Status Bar....................................................................................................................................................258
Opening the Table Data Editor................................................................................................................258
Toolbar........................................................................................................................................................258
Table Navigation.................................................................................................................................259
Actions.................................................................................................................................................259
Setting Table Data Editor Preferences.................................................................................................... 260
Table Data Editor Preferences................................................................................................................. 261
Color Options..................................................................................................................................... 261
Editor Options.................................................................................................................................... 261
Copy and Paste Options.................................................................................................................... 261
Actions.................................................................................................................................................262
Setting Table Data Editor Preferences............................................................................................. 262
Table Data Editing............................................................................................................................................ 263
Editing Table Data.....................................................................................................................................263
Inserting Table Data..................................................................................................................................263
Displaying Column Data by Value..........................................................................................................264
Deleting Table Rows..................................................................................................................................265
Deleting Data from Cells..........................................................................................................................265
Reverting Edits...........................................................................................................................................265
Finding and Replacing Data.................................................................................................................... 265
Find Replace........................................................................................................................................266
Find/Replace Values....................................................................................................................266
Find/Replace Criteria................................................................................................................. 266
Actions..........................................................................................................................................267
Selecting to Filter by Edits........................................................................................................................267
Viewing SQL Preview for Data Updates.................................................................................................267
Large Data and Objects Editing......................................................................................................................268
About the Blob Editor...............................................................................................................................268
Blob Editor.......................................................................................................................................... 269
Edit Blob Value............................................................................................................................ 269
Actions..........................................................................................................................................270
Opening the Blob Editor................................................................................................................... 270
Editing BLOB Data............................................................................................................................ 270
About the Clob Editor.............................................................................................................................. 271
Clob Editor..........................................................................................................................................272
Edit Clob Value............................................................................................................................272

Teradata Studio User Guide, Release 15.10 15


Table of Contents

Actions...........................................................................................................................................273
Opening the Clob Editor....................................................................................................................273
Editing CLOB Data............................................................................................................................. 274
About the Large Binary Editor................................................................................................................. 274
Opening the Large Binary Editor......................................................................................................275
Large Binary Editor.............................................................................................................................276
Edit Binary Data...........................................................................................................................276
Actions...........................................................................................................................................276
Editing Large Binary Data..................................................................................................................276
About the Large Text Editor......................................................................................................................277
Opening the Large Text Editor.......................................................................................................... 278
Large Text Editor................................................................................................................................. 278
Edit Text Value..............................................................................................................................278
Actions...........................................................................................................................................279
Editing Large Text Data......................................................................................................................279
About the XML Data Type Editor............................................................................................................279
Opening the XML Editor................................................................................................................... 281
XML Editor.......................................................................................................................................... 281
Edit XML.......................................................................................................................................282
Actions...........................................................................................................................................282
Editing XML Data............................................................................................................................... 282
Table Data Filtering........................................................................................................................................... 283
About Filtering Table Data........................................................................................................................283
About the Data Filter................................................................................................................................. 283
Filter Tab...............................................................................................................................................283
Sort Tab.................................................................................................................................................285

Chapter 10:
Database and Table Data Transfer.................................................................................. 287

About Transferring Data...................................................................................................................................287


Transferring Data From Tables.................................................................................................................287
Importing and Exporting Table Data...................................................................................................... 288
Data Transfer Wizard........................................................................................................................................ 288
About the Data Transfer Wizard...............................................................................................................288
Opening the Data Transfer Wizard...................................................................................................289
From a Tables Node..................................................................................................................... 289
From a Table Object.....................................................................................................................289
Working with Data Transfer Wizard.................................................................................................290
Transfer Data from Teradata Table............................................................................................290
Transfer Data from Hadoop Table.............................................................................................290
Transfer Data to Teradata Table................................................................................................. 290

16 Teradata Studio User Guide, Release 15.10


Table of Contents

Transfer Data to Hadoop Table.................................................................................................291


Transfer Data to Aster................................................................................................................ 291
Transfer Data from Aster........................................................................................................... 291
Transferring Data in Teradata and Hadoop Tables....................................................................... 291
Working with the Transfer Teradata Table to Hadoop Table Wizard........................... 291
Working with the Transfer Hadoop Table to Teradata Table Wizard........................... 292
Transferring Teradata Database Data.....................................................................................................292
Data Transfer to Teradata..................................................................................................................292
About Transfer Hadoop Table to Teradata Table.............................................................292
Data Transfer From Teradata........................................................................................................... 294
About Transferring a Teradata Table to a Hadoop Table............................................... 294
About Teradata to Hadoop Column Specification..........................................................295
Transferring Aster Database Data...........................................................................................................297
Data Transfer from Aster.................................................................................................................. 297
Exporting Data from Aster.................................................................................................297
Data Transfer to Aster....................................................................................................................... 299
Loading Data to an Aster Table......................................................................................... 299
About Transfer Hadoop Table to Aster........................................................................................... 300
About Hadoop to Aster Column Specification................................................................301
About Hadoop to Aster SQL Preview............................................................................... 303
Transferring Hadoop Data....................................................................................................................... 303
Data Transfer from Hadoop............................................................................................................. 303
Data Transfer to Hadoop.................................................................................................................. 304
About Transfer Teradata Table to Hadoop....................................................................... 304
About Teradata to Hadoop Column Specification..........................................................306
Transfer History View...................................................................................................................................... 307
About the Transfer History View.............................................................................................................307
Toolbar Actions.................................................................................................................................. 308
Toolbar Menu..................................................................................................................................... 308
Column Headers................................................................................................................................ 309
Column Header Context Menu........................................................................................................309
Transfer History Filter.............................................................................................................................. 310
Sort.............................................................................................................................................................. 310
Transfer Progress View.....................................................................................................................................311
About the Transfer Progress View...........................................................................................................311
Transfer Details..........................................................................................................................................312
Job Details.................................................................................................................................................. 313
Import and Load External Data..................................................................................................................... 313
About the Load Data Wizard................................................................................................................... 313
Load Data Wizard.............................................................................................................................. 315
Loading Table Data from a File........................................................................................................ 316

Teradata Studio User Guide, Release 15.10 17


Table of Contents

About the Load Data Wizard and JDBC................................................................................................. 319


About Smart Load Wizard.........................................................................................................................319
Opening the Smart Load Wizard...................................................................................................... 321
Importing External File Data to Teradata Tables............................................................................321
Editing Teradata Column Data Types.............................................................................................. 325
Importing External File Data to Aster Tables..................................................................................326
Editing Aster Column Data Types.................................................................................................... 330
Smart Load Type Options.................................................................................................................. 331
Aster Data Types................................................................................................................................. 332
Export External Data........................................................................................................................................ 333
About the Export Data Wizard................................................................................................................. 333
Exporting Table Data to an External File................................................................................................ 335
About Copying Teradata Objects.................................................................................................................... 335
Copying Objects Using the Data Transfer Wizard................................................................................. 335
Copying Table Data Between Teradata Databases.................................................................................337
Dropping Objects on Transfer View.........................................................................................................337
About Copy Table.......................................................................................................................................339
Copy Object Support................................................................................................................................. 340
Copy Object Wizard.......................................................................................................................................... 340
Copy Object Wizard................................................................................................................................... 340
About the Copy Object Wizard......................................................................................................... 340
About Filter Copy Column................................................................................................................ 341
About Column Specification............................................................................................................. 343
Column Data Type................................................................................................................344
About SQL Summary..........................................................................................................................346

Chapter 11:
Troubleshooting.................................................................................................................................. 349

Troubleshooting Studio.....................................................................................................................................349
Teradata Error Log..................................................................................................................................... 349
Turning on Debug...................................................................................................................................... 349
Parameter Tuning....................................................................................................................................... 350
Increasing Memory settings (OutOfMemory Error).............................................................................350

18 Teradata Studio User Guide, Release 15.10


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 Description
April 2015 Release 15.10

Additional Information
Additional information is available at Teradata Developer Exchange.

Related Documents
Title Publication ID
Teradata Studio, Studio Express, Plug-in for Eclipse Installation B035-2037
Guide
Teradata Studio, Studio Express, Plug-in for Eclipse Release B035-2040
Definition

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

Teradata Studio User Guide, Release 15.10 19


Preface

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.

20 Teradata Studio User Guide, Release 15.10


CHAPTER 1

Overview

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 by seamlessly integrating
administration, data management and transfer, and SQL query development across the
Teradata, Aster, and Hadoop platforms.

Teradata Studio Key Features

Key Studio Features


Feature Description
Studio Perspectives Teradata Administrator perspective for performing database
administrative and management tasks.
Query Development perspective for the development and
execution of SQL query statements.
Data Transfer perspective for loading, exporting, importing,
and copying data from one database to another.
Database Development perspective for managing non-
Teradata databases, such as Oracle, IBM DB2, and Microsoft
SQL Server.
Manage Teradata Database, Create Databases, Users, Tables, Views, Stored Procedures,
Teradata Aster Database, and User Defined Functions, and User Defined Types objects.
Hadoop objects Modify and DROP Database and User objects.
Copy Tables, Views, Stored Procedures, Macros, or User-
Defined Types definitions to another database, or to another
system.

Teradata Studio User Guide, Release 15.10 21


Chapter 1 Overview

Feature Description
Drop or rename Tables, Views, Stored Procedures, Macros, or
User Defined Functions
Display information about Database, Users, Tables, Views,
Macros, Stored Procedures, User-Defined Functions, User-
Defined Types
Manage privileges on database Administer roles and profiles
objects Grant or revoke access and system rights
Set up the rules for Query and Access Logging
Manage databases and Create connection profiles to Teradata Databases, Teradata
connections Aster Databases, and Hadoop systems.
Move space from one database to another
Customize display by moving view panels and setting
preferences.
Transfer data between Teradata Databases, Teradata Aster
Databases, and Hadoop systems.

Key Studio Interface Components


Component Description
Compare SQL Objects Wizard Select database objects of same type to compare the Data
Definition Language (DDL) text.
Display, compare and edit DDL content of the two database
objects side-by-side in Compare Editor.
Highlights differences in text and changes in elements
View differences and changes using Next and Previous buttons.
Save or Execute DDL query statements.
Copy Object Wizard Copy tables and table data from one Teradata system to
another.
Launch from the Data Transfer Wizard or drag and drop
objects from the Data Source Explorer.
Copy tables from Data Source Explorer to Data Labs.
Data Source Explorer Find and view objects using a hierarchical display that you can
customize using preferences.
Access menu options to run Stored Procedures, Macros, and
User-defined Functions.
Select databases and user objects to load using preferences.
Data Transfer Wizard Transfer data from one database to another across Teradata,
Aster, and Hadoop platforms.
Export data from a database to an external file on the file
system.
Load data from a file on the file system to a database or table.
Copy table data from one Teradata table to another.
Object Viewer Explore the structure and content of Teradata Databases,
Teradata Aster Databases, and Hadoop systems.

22 Teradata Studio User Guide, Release 15.10


Chapter 1 Overview

Component Description
Display detailed information about database objects displayed
in Data Source Explorer.
Drill down to objects and attributes of objects to understand
structure of databases, tables, and other object types.
Filter object views and perform functions on objects, such as
create views, and modify privileges for the object.
Result Set Viewer Displays the result set data, allowing it to be saved, exported, and
printed.
SQL Editor Preview SQL query statements.
Define SQL statements for execution or saving to file or
project.
Parse SQL statements for syntax errors.
Format SQL according to selected formatting options.
Connect to databases and view connection status.
Create, modify, and execute individual or multiple SQL
statements.
SQL History Create a historical record of submitted SQL queries that
include details such as timestamps, results status, record
counts, and so forth.
Export history data and shared with other Teradata Studio
users.
SQL Query Builder Visually build and edit SQL queries.
Table Data Editor Insert, delete, and update data in a Teradata database table.
Filter to see only rows you edited.
Set filter rules on table columns to show only data of interest.
Export table data to a file.
Manage large tables that contain thousands of rows of data.
Access Blob, Clob, XML Data Type, Large Text Data, and Large
Binary Data editors to manage tables that contain large objects.
Transfer History View View list of completed data transfer jobs.
Display job details such as source and destination, duration,
and success or failure of job.
Reexecute past job based on the historical setup of the job.
Transfer Progress View Monitor data transfer jobs.
Shows list of transfer jobs and status of each job.
Includes progress bar to indicate percentage and rate of
completion.
Cancel jobs in queue.
Completed jobs display in Transfer History View.
Transfer View Connect to a Connection Profile to view the structure of the
database for that profile.

Teradata Studio User Guide, Release 15.10 23


Chapter 1 Overview

Component Description
Transfer objects and data between Teradata Databases and
Hadoop systems, or from one Teradata system to another, or
from one Hadoop system to another.
Locate database objects as the source or destination for
importing or exporting the object data.
Drag and drop database objects between the Data Source
Explorer and the Transfer View to transfer them from one
system to another.

24 Teradata Studio User Guide, Release 15.10


CHAPTER 2

Teradata Studio Basics

Getting Started

Launching Studio Workbench

1 Follow these instructions 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 Teradata Studio in the TeradataStudio directory.


Windows Double-click the Teradata Studio desktop icon shortcut.

The Teradata Studio workbench opens on your desktop.

Setting Up Your Workspace

When Teradata Studio is first launched, a workspace directory called workspace-studio


is created in the locations noted below. The workspace is used for storing files and preference
settings.
Operating System Location
Windows C:\Users\<Username>\workspace-studio

Linux The directory in which Teradata Studio is run.


Mac OS /Users/<Username>/Documents/StudioWorkspace

If you want to change the location of your workspace directory, you must launch Teradata
Studio using the -data option.
For example: TeradataStudio.exe -data C:\TeradataStudioWorkspace
Within the workspace directory, files are stored in projects. An initial project was created for
your SQL files, called SQL. Click on the Project Explorer tab to view the SQL project. You
can create additional projects using the New Project dialog. New SQL files can be created by
right-clicking the SQL folder and selecting the New > SQL File option.

Teradata Studio User Guide, Release 15.10 25


Chapter 2 Teradata Studio Basics

Changing Workspace Locations on Linux


To change the Studio workspace location on a Linux system, specify the new directory
location in a command-line program execution string.
1 Open a terminal window.
2 At the shell prompt, specify the new directory as shown in this example:
./opt/teradata/TeradataStudio/TeradataStudio -data /home/guestUser/
MyWorkspace

Changing Workspace Locations on MacIntosh


To change a Studio workspace location on a MacIntosh system, specify the new directory
location in a command-line program execution string.
1 Open the Terminal application.
2 Specify the new directory as shown in this example:
/Applications/TeradataStudio/Teradata/Studio.app/Contents/MacOS/
TeradataStudio -data /Users/guestUser/Documents/MyWorkspace

Changing Workspace Locations on Windows


To change the Studio workspace directory location on a Microsoft Windows system, modify
the properties of the Teradata Studio shortcut on your desktop.
1 Right-click the Teradata Studio shortcut on your desktop and select Properties.
2 In Teradata Studio Properties , locate the Target field.
3 Add the -data option and the new location for the workspace to the end of the Target
field string as shown in this example:
-data Users/guestUser/Documents/MyWorkspace

Getting Started With Teradata Studio

You must connect to the database in which you want to work. The first step is to create
connection profiles for each database that you manage and/or in which you develop data and
objects.
You can open the Connection Profile you create in Data Source Explorer and browse the
Databases, Indexes, Macros, Tables, Stored Procedures, User-defined Functions, User-
defined Types, and Views folders to discover database objects. Clicking on an object in the
Data Source Explorer displays the object in the Object Viewer.
Note: The highest level in the tree is the database server node, indicated by the database
name provided in the Connection Profile. If no database name was provided, the default
database name 'DBC' is used.

Exiting Studio Workbench

26 Teradata Studio User Guide, Release 15.10


Chapter 2 Teradata Studio Basics

1 From the main Teradata Studio menu bar, select File > Exit.

Teradata Studio Interface

Studio 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. The
following example shows the Query Development perspective and displays these navigation
elements and views:
Data Source Explorer
Project Explorer
SQL Editor
Teradata SQL History
Teradata Result Set Viewer
Object Viewer

Toolbar
The Studio toolbar is the main toolbar for the Studio workbench.
Perspective Tabs
You can select to display tabs for as many different perspectives as you choose. Select
a perspective tab to dynamically move from one workbench perspective to another.

Teradata Studio User Guide, Release 15.10 27


Chapter 2 Teradata Studio Basics

SQL Editor
In this example, the SQL Editor is shown. You can display other editors, such as the
Table Data Editor. Editors display when you select a specific perspective, for example
Query Development, or edit a database object, as for example, a table in the Table
Data Editor.
View Panes
Studio provides multiple view panes for the different type of development work you
perform in the workbench. These views include the Object Viewer for discovery of
objects in your database, and the Transfer Progress View for investigating executing
data transfer jobs and their status.
View Toolbar
Each view includes a toolbar that contains a selection of user actions that are specific
to the view. For common workbench actions, go to the main Studio toolbar at the
top of the screen.
View Details
The detailed information that displays in a view is presented in several ways. In this
example, the view data is shown in table columns which you can often customize in
the view preferences. Some views display additional details in tabbed views.
Status Messages
A status message displays at the bottom of the workbench to show information
about a process or action that may be in progress.
Navigation Pane
The Data Source Explorer displays the databases available through connection
profiles. After you connect to a database, it shows a hierarchical display of the
objects in that database. The Project Explorer shows the lists of projects you create
to organize and contain files and other elements related to a specific development
project.

Customizing the Display


You can move the view panels around the display area, as well as move sections of the
toolbar. You can also remove a view panel by clicking the X on the view tab. A 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.

Studio Views

Teradata Studio Views


Teradata Studio provides multiple views and tools that enable you to explore, discover, and
manage Teradata-supported databases, to develop and execute SQL queries, and to transfer
data between databases.

28 Teradata Studio User Guide, Release 15.10


Chapter 2 Teradata Studio Basics

View Description
Data Source Explorer Contains the database object tree display. 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.
Object Viewer Displays detailed information about objects in a database. Select a
database object in Data Source Explorer to display detailed
information about the object in the Object Viewer.
Data Lab View 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. You must
provide a Connection Profiles in order to execute the SQL
statements. Double-clicking a file in the Project Explorer causes
the file to be opened in the SQL Editor view.
SQL History View Contains the results when executing SQL statements and running
database routines, user-defined functions, and triggers.
Result Set Viewer Displays the result set data. Individual Result Set tabs are created
for each result set. The Result Set Viewer also contains a toolbar
with actions that can occur on the result set data, such as saving,
exporting, or printing the result set data.
Transfer History View Provides an enhanced display of the Data Transfer History
information in the database. When a data transfer completes, an
entry is placed in the Transfer History View.
Transfer Progress View 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.
3 In Show View dialog, select a view and click OK.
The view you select displays in the workbench.

Teradata Studio User Guide, Release 15.10 29


Chapter 2 Teradata Studio Basics

Moving View Panels


You can customize the look and feel of Teradata Studio by moving view panels within the
Teradata Studio display window. A view can be moved by selecting the view and dragging it
to a new location. As you move the view over the display, the mouse pointer changes
depending on where you want to drop or dock the view. You can also drag the view outside
the display area. The view then becomes a "detached" view.
Mouse Pointer Description
up arrow Indicates view will be docked above the view where your mouse
pointer currently is.
down arrow Indicates view will be docked below the view where your mouse
point currently is.
right arrow Indicates view will be docked to the right of the view where your
mouse point currently is.
left arrow Indicates view will be docked to the left of the view where your
mouse point currently is.
folder stack Indicates view will be stacked as a tab in the same View where your
mouse point currently is.
window pane Indicates view will be detached from the Teradata Studio window
and shown in its own window.
circle slash Indicates that you cannot dock the view in this area.

You can also remove a view panel by clicking the X on the view tab. A view can be re-
displayed by selecting the view from the Windows > Show View option in the main menu.

Studio Toolbars

Each Teradata Studio view contains a toolbar that gives you quick access to functions and
dialogs for creating, modifying, and administering database objects. For example, included in
the View toolbar are buttons to minimize, maximize, and restore the view.
The Teradata Studio toolbar is divided into different sections:

File and Edit Toolbar


The File and Edit toolbar buttons are used when editing an SQL file. They include
Save, SaveAs, Cut, Copy, Paste, Undo, Redo, Print, and Show Whitespace.

SQL Toolbar
The SQL toolbar buttons are used to perform actions on the SQL statements within
the SQL Editor. They include Execute as Individual Statements, Execute as One
Statement, Explain, Format, Prompt for Notes, Code Assist Auto-activation. SELECT
Statement and SHOW DDL are activated when a table is selected in the DSE.

30 Teradata Studio User Guide, Release 15.10


Chapter 2 Teradata Studio Basics

Data Tools Toolbar


The Data Tools toolbar button provides actions that are performed on a database
table, such as Show Row Count, Teradata Load, and Teradata Export.

Tools Toolbar
The Tools toolbar button provides actions to create or modify database objects, such
as creating or modifying databases or users, creating tables, views, stored procedures,
macros, triggers, and user defined types.

Security and Administer Toolbar


The Security and Administer toolbar button provides actions to administer Profiles
and Roles, and grant and revoke Rights and Privileges.

Directional Toolbar
The Directional toolbar buttons are used to reference locations within the SQL file.
They include Next Annotation, Previous Annotation, and Last Edit Location.

Sections of the toolbar can be moved above or below the main toolbar by selecting the
section and dragging it to the new location.

Studio Preferences

Teradata Studio Preferences

Data Management Preferences


Preference Description
Connectivity Configures the connectivity Driver Definitions by adding, editing,
removing, or copying driver templates.
Label Decorations Specifies the display format for columns in the Data Source Explorer.
SQL Development SQL Development options are:

Option Description
General Specifies whether to continue when errors occur
during SQL execution.
SQL Editor Sets preference options for the SQL Editor for code
assist, connection behavior for SQL files, syntax
colors, and SQL templates.

Teradata Studio User Guide, Release 15.10 31


Chapter 2 Teradata Studio Basics

Preference Description

Option Description
SQL Query Enables you to omit the current database/schema
Builder from the generated SQL statements of the SQL
Query Builder.

General Preferences
General options are used to configure the open mode, background running jobs, and heap
status.
Preference Description
Appearance Customizes the display appearance by enabling you to select 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. This option 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.
Preferences
Data Source Explorer Sets preferences for display of database and user object hierarchy and for
Load 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.

32 Teradata Studio User Guide, Release 15.10


Chapter 2 Teradata Studio Basics

Preference Description
Export Sets the preference to launch a native editor and customizes export options
for the output Microsoft Excel file.
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 Sets your preferences for which types of connection profiles to show as
Connection Types options in the New Connection Profile dialog.
Object Viewer Specifies which tabs are visible for objects displayed
QueryBand Specifies the query band name value pairs to provide as options for sessions
per connection. You select which query bands to use when you create a
connection profile and the JDBC properties for the connection.
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 Open options for Studio perspectives.
Table Data Editor Sets preferences for selection color options, filter thresholds, and editor
display and copy/paste options.

Setting Preferences
You can modify preferences for Teradata Studio by selecting Window > Preferences from
the menu bar. You can type in a filter text to filter the information to a more specific
preference item or navigate to the preference from the left hand tree display. Changes to
preferences are stored within your workspace.

Teradata Studio Perspectives


Teradata Studio provides four configured perspectives:
Perspective Description
Teradata Administrator Integrated work environment for managing data objects in
Teradata Databases, Aster Databases, and Hadoop systems.
Data Transfer Integrated views, menus, and toolbars optimized for transferring
data and monitoring the transfer jobs using progress and history
views.
Query Development Integrated development environment for creating, editing, testing,
and executing SQL/DDL query statements.

Teradata Studio User Guide, Release 15.10 33


Chapter 2 Teradata Studio Basics

Perspective Description
Database Development Integrated development environment for developing and
managing databases such as Oracle, IBM DB2, and Microsoft SQl
Server.

You can create additional custom perspectives by selecting Window > Customize
Perspective from the top menu bar.

Teradata Administrator Perspective

The Teradata Administrator Perspective launches a related set of menus, toolbars, and
views that focus on database administrative tasks. The views enable an administrator to
create, manage, or administer database objects, view objects in specific databases, and
develop and run SQL statements.

The Teradata Administrator Perspective launches the following views:


View Description
Data Source Explorer Using the Data Source Explorer you can connect to a specific
database system using a Connection Profile and then view and
manage the database objects in the connected system.
Project Explorer The Project Explorer view panel provides 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.
Object Viewer The Object Viewer provides detailed information about database
objects you select either in Data Source Explorer or in the Object
Viewer.

Another useful view is the Data Lab View. Select the Window > Show View menu option to
open additional views.

Opening the Teradata Administrator Perspective


The Teradata Administrator perspective focuses on tasks that a database administrator
performs when developing and managing data and objects in a database. The perspective

34 Teradata Studio User Guide, Release 15.10


Chapter 2 Teradata Studio Basics

opens views that provide detailed information about selected database objects and their
elements.
To open the Teradata Administrator perspective, select Window > Teradata
Administrator.
You can also open the perspective by clicking in the left corner of the tab bar.

Query Development Perspective

The Query Development Perspective opens views that assist with developing and running
SQL queries that manage data and objects in your databases.

The following views automatically open when you select the Query Development
Perspective option.
View Description
Data Source Explorer Using the Data Source Explorer you can connect to a specific
database system using a Connection Profile and then view and
manage the database objects in the connected system.
Project Explorer The Project Explorer view panel provides 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.
SQL Editor The SQL Editor enables you to develop, edit, test, and run SQL
query statements. It provides a Connection Profiles option for
executing the SQL statements. Double-clicking a file in the Project
Explorer causes the file to be opened

Teradata Studio User Guide, Release 15.10 35


Chapter 2 Teradata Studio Basics

View Description
Result Set Viewer The Result Set Viewer provides an enhanced view of the result set,
including options to hide columns, filter on column values, copy
data to clipboard, format cell data, and switch between view
modes. Separate tabbed views are created for each generated result
set.
SQL History The SQL History contains the results when executing SQL
statements and running database routines, user-defined functions,
or triggers.

Another useful view is Data Lab View. Select the Window > Window menu option to open
these views.

Toolbar for Query Development


The Query Development toolbar contains navigation aids and action buttons that help you
find objects in the Data Source Explorer, edit SQL text in the SQL Editor, and open new
SQL Editors to work on different objects.

Actions
Option Icon Label Description
Save the File (Ctrl + S) Saves the file.

Cut (Ctrl + X) Cuts the selected text.

Copy (Ctrl + Insert) Copies the selected text.

Undo Typing (Ctrl + Z) Removes the most recent text change.

Redo Typing (Ctrl + Y) Re-inserts the most recent text change.

Print (Ctrl + P) Prints the text displayed in the SQL Editor.

New SQL Editor Opens a new SQL Editor view.

Show DDL Displays the Data Definition Language (DDL) text in


the SQL Editor.
Find Objects in Data Opens the Find Objects dialog to enable you to find a
Source Explorer database object that matches a certain text value in the
Data Source Explorer.
Repeat Last Find Repeat the last Find from the last found object.

Opening the Query Development Perspective


The Query Development perspective opens a set of SQL development tools and views for
creating, debugging, and testing SQL code.
To open the Query Development perspective, select Window > Query Development.

36 Teradata Studio User Guide, Release 15.10


Chapter 2 Teradata Studio Basics

You can also open the perspective by clicking in the left corner of the tab bar.

Data Transfer Perspective

The Data Transfer Perspective launches an initial set of views that focus on data transfers
between Teradata Databases, Aster, and Hadoop databases. 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 opens the following views:


View Description
Data Source Explorer Using the Data Source Explorer you can connect to a specific
database system using a Connection Profile and then view and
manage the database objects in the connected system.
Transfer View Use the Transfer View in combination with the Data Source
Explorer to transfer data from one Teradata or Hadoop system to
another.
Transfer Progress Viewer The Transfer Progress View shows 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.
Transfer History View 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.

Opening the Data Transfer Perspective


Database administrators and developers use the Data Transfer perspective to transfer data
between databases and tables, and to view transfer history records.

Teradata Studio User Guide, Release 15.10 37


Chapter 2 Teradata Studio Basics

To open the Data Transfer perspective, select Window > Data Transfer.
You can also open the perspective by clicking in the left corner of the tab bar.

Database Development Perspective

The Database Development perspective launches menus, toolbars, and views that focus on
developing databases such as Oracle, IBM DB2, and Microsoft SQL Server. The perspective
enables you to develop database objects, develop SQL queries, perform database tasks, and
view results.
The Database Development perspective opens the following views:
View Description
Data Source Explorer Using the Data Source Explorer you can connect to a specific
database system using a Connection Profile and then view and
manage the database objects in the connected system.
SQL Editor The SQL Editor enables you to develop SQL query statements to
manage objects and data in your databases.
SQL Results The SQL Results view is a feature of the Eclipse Data Tools
Platform (DTP) project and displays the results from executing
SQL statements, running procedural routine objects, and
creating database objects.
Bookmarks The Bookmarks view is an Eclipse feature that displays all
bookmarks in your workbench.

Opening the Database Development Perspective

1 Right-click the Open Perspective ( ) button in the left corner of the tab bar.

2 Select Other > Database Development.

38 Teradata Studio User Guide, Release 15.10


CHAPTER 3

Database Connectivity

About Connection Profiles


A connection profile contains the connection property information needed to connect to a
data source in your enterprise.

Supported Database Connection Profiles


You can create the following types of connection profiles in Teradata Studio for Teradata
databases.
Connection Profile Type Description
Aster Database Connects to Teradata Aster Database using the Aster
Embedded JDBC Driver (default).
Hadoop Generic System Connects to open source Hadoop systems using the
WebHDFS service.
Hadoop Hortonworks Connects to Hortonworks Hadoop systems using these user-
defined options: Knox Gateway, Teradata Connection to
Hadoop (TDCH), Hive JDBC Driver, and SQL-H.
Teradata Database Connects to Teradata Databases using the Teradata Embedded
JDBC Driver (default).

New Profile Connection Types Preferences

Active connection types for new profile dialog


Select which connection types are displayed when you create a new connection profile using
the New Connection Profile dialog.
Option Description
Aster Database Connects to Teradata Aster Database using the Aster
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.

Teradata Studio User Guide, Release 15.10 39


Chapter 3 Database Connectivity

Option Description
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 System Connects to open source Hadoop systems using the
WebHDFS service (default).
Hortonworks Connects to Hortonworks Hadoop systems using these
user-defined options: Knox Gateway, Teradata
Connection to Hadoop (TDCH), Hive JDBC Driver,
and SQL-H (default).
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).

Teradata Database Connectivity

Teradata Connection Profiles

Creating a Teradata Connection Profile


The Connection Profile contains the JDBC information required to connect to an instance
of a Teradata Database.
1 Open the Data Source Explorer.
2 Right-click the Database Connections folder and select New.
The New Connection Profile wizard appears.
3 Select Teradata Database from the list of Connection Profile Types.
4 Type a Name that helps you identify the connection profile definition easily.
5 [Optional] Type a brief Description for this specific Connection Profile definition.
6 Click Next.
7 Select a driver from the Select a driver from the drop-down list.
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 .
8 Type the host name running the Teradata Database in the Database Server Name field.
9 Type the Teradata user name for the connection in the User Name[Domain].
If you are connecting via Kerberos authentication, include the Domain name.

40 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

10 Type the Teradata password for the connection in the Password field.
11 If you are using advanced authentication, such as LDAP or Kerberos, select the
authentication mechanism from the list.
If you did not choose LDAP or Kerberos, the default protected logon is used.
12 [Optional] Set the Database field if your connection requires that a default database be
set at logon.
13 Select Save Password to save the password.
The password is valid for the workbench session.
14 In JDBC Connection Properties, accept the default properties or add and remove JDBC
connection properties to specify the connection details for the profile.

Option Description
Add Opens the Add JDBC Property dialog and lets you create property value
pairs by selecting a JDBC property and the corresponding value. You can
also add query bands for the session in the Add JDBC Property dialog.
Remove Removes a selected JDBC property value pair from the list.
Clear All Removes all JDBC properties from the list.
Save Properties Saves the JDBC properties in the list.
Reset to Defaults Restores the default JDBC Connection Properties and displays them in the
list.

The default JDBC connection properties include a QueryBand string which contains
query band name value pairs (separated by semicolons) for a session.
15 [Optional] Click Cache Properites to open the Database Cache Properties dialog and
select the databases to cache.
16 [Optional] Click Delete Cache to delete cache files.
The Confirm Delete Cache dialog displays and prompts you to confirm the delete
action. Click Yes to delete the files.
17 Specify when to connect by selecting one or both of these options:

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

18 Click Next to view the Summary information for this connection profile.
19 Click Finish to create the connection profile and display it in Data Source Explorer.

Related Topics
Adding a New Teradata Driver Definition, on page 42

Teradata Studio User Guide, Release 15.10 41


Chapter 3 Database Connectivity

Driver Definitions

Adding a New Teradata Driver Definition


1 Open the New Connection Profile wizard.
2 Select Teradata Database from the list of Connection Profile Types and enter a Name
for the connection profile.
3 [Optional] Type a Description and click Next.
The Specify a Driver and Connection Details dialog opens with the Teradata Embedded
JDBC Driver template selected as the default JDBC driver template in the Select a driver
from the drop-down field.
4 [Optional] If you need to add a new driver definition, click .
a In the New Driver Definition dialog, specify the Teradata External JDBC Driver
template. and enter the new.
b In Driver name, type a unique name for the driver definition.

c Click the JAR List tab and add the list of Teradata JDBC Driver JARs.
If you need to locate your Teradata JDBC Driver JAR files on the file system, click Add
Jar/Zip.
d Click the Properties tab to edit the JDBC driver properties.

e Click OK to save your new Teradata Driver definition and return to the New Teradata
Connection Profile wizard.
The new driver definition is now selected in the Select a driver from the drop-down
list.

JDBC Connection Properties

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, 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.

42 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

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.
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.

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 Teradata 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.

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,

Teradata Studio User Guide, Release 15.10 43


Chapter 3 Database Connectivity

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

Control query band settings

Options Descriptions
Use 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 per
connection.
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. You
can specify this query band when you create the connection profile for a
Teradata Database.

Aster Database Connectivity

About Connection Profiles for Aster Database

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.

Related Topics
Creating an Aster Database Connection Profile, on page 46
About Caching Aster Schemas, on page 51

44 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

Aster Database Connection Properties


The Aster Database Connection Properties dialog details the JDBC information required
to connect to an instance of an Aster database. The dialog shows 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 defined in the profile
JDBC connection properties
Options for caching database files and deleting cache files

Connection Properties
Option Description
Select a driver from the drop- The Aster Embedded JDBC Driver template is selected as the
down default JDBC driver template.
Database Server Name Name of the database server that hosts the Aster Database.
User Name Aster database user name used to connect to the database server.
Password Password required to access the Aster database defined in this
Connection Profile.
Port Number Port number to use for the Aster database 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.

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.

Teradata Studio User Guide, Release 15.10 45


Chapter 3 Database Connectivity

Button Description
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
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 connects to the desired
Aster database.
Option Description
Test Connection Tests the connection.

Creating an Aster Database Connection Profile

1 Open Data Source Explorer.


2 Right-click Database Connections and select New....
The New Connection Profile wizard opens.
3 From the list of Connection Profile Types, select Aster Database .
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.
4 Type a Name that identifies the Aster server to which the profile connects.
5 [Optional] Type a brief Description for this connection profile.
6 Click Next.
The Specify a Driver and Connection Details dialog opens.
7 Select a driver from the Select a driver from the drop-down list.
The Aster Embedded JDBC Driver template is selected as the default JDBC driver
template.
8 In Database Server Name, type the name of the database server or URL of the server
that hosts the Aster Database.
9 Type the Aster Database User Name required to connect to the database server.
10 Type the Password for the user name you entered in the previous step.
This is the password required to connect to the Aster Database server.

46 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

11 Accept the default Port Number or type a different port number.


The default port number is 2406.
12 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.
13 Select the Save Password check box if you want the password saved and do not want to
enter a password each time you connect.
If you do not select this option, you will be prompted to enter a password each time a
connection to the database is made.
Note: The password you entered in the Password field is valid for each workbench
session and is not affected by this selection.
14 [Optional] Add JDBC connection properties to the list of JDBC Connection Properties:

a Click Add.
The Add JDBC Property dialog opens.
b To enter a new JDBC property, select USER_ENTERED_PROPERTY.

c In the New JDBC Property dialog define a new property by typing a name in
Property Name.
d Type the paired value for the new property in Property Value and click OK.

e Click OK.
The new property value displays in JDBC Connection Properties.
f 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.
15 Repeat the above steps to add multiple properties.
16 [Optional] Click Cache Properties to configure schema cache properties.
17 [Optional] Click Delete Cache Files to delete cached files stored in Aster Database
server.
18 Specify when to connect by selecting one or both of these options:

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

19 [Optional] Click Test Connection to verify the connection is successful.


A message box appears stating the ping either succeeded or failed. Click OK to close the
message.

Teradata Studio User Guide, Release 15.10 47


Chapter 3 Database Connectivity

20 Click Finish to close the wizard.

Related Topics
Caching Aster Schemas, on page 52
Deleting Aster Cache Files, on page 54

Connecting to an Aster Database


Connection profiles contain all the information required to securely connect to an Aster
Database server.
1 Open Data Source Explorer.
2 Right-click an Aster Database connection profile name.
3 Select Connect.
The Aster Database Connection Properties dialog opens.
4 Verify the User Name.
5 Type the Aster Database user Password.
6 Click OK.
If the connection to the Aster Database 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


You disconnect from an Aster Database server by using the connection profile options.
1 In Data Source Explorer, right-click the Aster Database connection profile of the Aster
Database 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 Database connection profile.

Deleting an Aster Connection Profile


You delete a connection profile directly from the Data Source Explorer.
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.

48 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

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. The Add button is
located on the right side of the JDBC Connection Properties display area.
1 Right-click an Aster Database connection profile in Data Source Explorer.
The Aster Database Connection dialog opens.
2 Click Add.
The Add JDBC Property dialog opens and displays a list of JDBC properties and values
that you can add to the connection profile.
3 Under JDBC Properties, select the property you want to add.
4 (Optional) To manually enter a JDBC property that is not listed, select
USER_ENTERED_PROPERTY.

a In the New JDBC Property dialog define a new property by typing a name in
Property Name.
b Type the paired value for the new property in Property Value and click OK.
The property value displays in the Select Property Value field as
<name_property>=<property_value>.
5 Click OK.
The new property value displays in JDBC Connection Properties.
6 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.
7 Repeat the above steps to add multiple properties.

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 Data Source Explorer.
2 Right-click Database Connection and select New.
The New Connection Profile wizard opens.
3 Under Connection Profile Types, select Aster Database.
You can view a smaller list of databases by typing a character string on which to filter the
list, and then selecting the database for the Connection Profile.
4 In the Name field, type a name for the Connection Profile or accept the default name.
5 [Optional] Type a comment or description of the profile you are creating.

Teradata Studio User Guide, Release 15.10 49


Chapter 3 Database Connectivity

6 Click Next.
7 Click the asterisk button ( ) to add a new driver definition.
The Aster Embedded JDBC Driver template is selected as the default JDBC driver
template in the Select a driver from the drop-down list.
8 Select the Aster External JDBC Driver template then enter the new Driver name.
9 Click the Jar List tab and add the list of Aster JDBC Driver JARs.
Locate your Aster JDBC Driver JAR files on the file system by clicking Add Jar/Zip.
10 Click the Properties tab to edit the JDBC driver properties.
11 Click OK to save your new Aster Database Driver definition and return to the New
Connection Profile wizard.
Your new driver definition is now selected in the Select a driver from the drop-down
list.

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.

Actions
Option Description
OK Saves changes and closes the New JDBC Property dialog.

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.

50 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

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 create a user-defined name/value property pair
in the New JDBC Property dialog.

Actions
Option Description
OK Closes the Add 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.

Teradata Studio User Guide, Release 15.10 51


Chapter 3 Database Connectivity

Related Topics
About Refreshing Schema Cache, on page 53

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.
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,.

52 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

Option Description

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.

Actions
Use the buttons at the bottom of the Select Schema text area to manage the schema selection
list.
Option Description
Select All Selects all schema in the list.
Clear All Clears all schema from the list.
OK Saves changes and closes the dialog.

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.
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.

Teradata Studio User Guide, Release 15.10 53


Chapter 3 Database Connectivity

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.

Related Topics
Aster Database Connection Properties, on page 45
Editing Aster Cache Schema Properties, on page 53

Hadoop Connectivity

Creating a Hadoop Generic System Connection Profile

1 Open the Data Source Explorer, right-click the Database Connections folder and select
New.
You can also click in the main toolbar. The New Connection Profile wizard opens.
2 Under Connection Profile Types, select Hadoop Generic System from the list.
3 Type a Name that helps you identify this Connection Profile definition.
4 [Optional] Type a brief Description for this specific Connection Profile definition.
5 Click Next.
6 Enter the credentials required to access the Hadoop system:

a In WebHDFS Host Name, type the host name or IP address of the system configured
to provide access to the Hadoop systems's distributed file system.

54 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

b In WebHDFS Port Number, type the port number to use to communicate with the
Hadoop system's WebHDFS service.
c In WebHDFS User Name, type the user name with permissions to access the
WebHDFS host.
7 Specify when to connect to this Hadoop system by choosing these options:

Option Description
Connect when the wizard completes Connects immediately after you click Finish. This is
the default.
Connect every time the workbench is Connects each time you connect to your Eclipse
started workbench.

8 [Optional] Click Test Connection to test the connection.


A message reports that the connection succeeded or failed. Click OK.
9 Click Finish to close the wizard and connect to the Hadoop database.

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.
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.
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.
JDBC 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.
SQL-H Select this option if you plan to use this connection for data
transfers from the Hortonworks Hadoop System to an Aster
Database.

Creating Hadoop Hortonworks Connection Profiles Using Knox Gateway


1 Open the Data Source Explorer.
2 Right-click the Database Connections folder and select New.
You can also click in the main toolbar. The New Connection Profile wizard opens.

Teradata Studio User Guide, Release 15.10 55


Chapter 3 Database Connectivity

3 Under Connection Profile Types, select Hadoop Hortonworks from the list.
4 Type a Name that helps you identify this Connection Profile definition.
5 [Optional] Type a brief Description for this specific Connection Profile definition.
6 Click Next.
7 In Connection Properties, select Knox Gateway.
8 [Optional - not available in Studio Express] Select these additional connection options if
needed:

Option Description
TDCH (Teradata Data Teradata Connector for Hadoop enables you to move data
Transfers) between Teradata Databases and Hadoop systems.
SQL-H (Hadoop to Aster SQL-H enables you to transfer data from the Hortonworks
Data Transfers) Hadoop System to an Aster Database.

9 Specify when to connect by selecting one or both of these options:

Option Description
Connect when the wizard completes Connects immediately after you click Finish. This is
the default.
Connect every time the workbench is Connects each time you connect to your Eclipse
started workbench.

10 Click Next.
11 Enter the credentials required to access the Knox connection.

a In Gateway Host, type the host name.

b In Gateway Port Number, type the port number for the host.

c In Cluster Name, type the cluster name.

d In 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 you entered in the last step.
g [Optional] Click Test Connection to verify the connection is successful.
12 Click Next.
A Summary of the information you entered in the previous steps displays.
13 Click Finish.
If the connection succeeds, the new Hadoop Hortonworks connection profile displays in
the Database Connections list in Data Source Explorer.

56 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

Creating Hadoop Hortonworks Connection Profiles Using TDCH


Teradata Connector for Hadoop (TDCH) enables you to move data between Teradata
Databases and Hadoop systems.
1 Open the Data Source Explorer.
2 Right-click the Database Connections folder and select New.
You can also click in the main toolbar. The New Connection Profile wizard opens.
3 Under Connection Profile Types, select Hadoop Hortonworks from the list.
4 Type a Name that helps you identify this Connection Profile definition.
5 [Optional] Type a brief Description for this specific Connection Profile definition.
6 Click Next.
7 In Connection Properties, select TDCH.
8 [Optional] Select these additional connection options as needed:

Connection Option Description


Knox Gateway Select this option if you connect to the Hortonworks Hadoop system
through a Knox Gateway. If you select this option, you are not able to
select JDBC also.
JDBC (Creating and Select this option if you access the Hortonworks Hadoop system
Running SQL) using SQL from the SQL Editor. If you select this option, you are not
able to select Knox also.
SQL-H (Hadoop to SQL-H enables you to transfer data from the Hortonworks Hadoop
Aster Data Transfers) System to an Aster Database.

9 Specify when to connect by selecting one or both of these options:

Option Description
Connect when the wizard completes Connects immediately after you click Finish. This is
the default.
Connect every time the workbench is Connects each time you connect to your Eclipse
started workbench.

10 Click Next.
11 If you select to connect using only TDCH, or (optional) TDCH with JDBC and/or SQL-
H, enter the following credentials to access the Hadoop system:
a In WebHDFS Host Name, type the host name or IP address of the system configured
to provide access to the Hadoop systems's distributed file system.
b In WebHDFS Port Number, type the port number to use to communicate with the
Hadoop system's WebHDFS service. For Hortonworks, this port is 50070 by default.
c In WebHDFS User Name, type the user name with permissions to access the
WebHDFS host.

Teradata Studio User Guide, Release 15.10 57


Chapter 3 Database Connectivity

d [Optional] Click Test Connection to verify the connection is successful.


12 [Optional] If you select to connect using TDCH and Knox Gateway, complete the
properties for a Knox connection.
When you select Knox, the TDCH connection properties are automatically generated
because the Knox Gateway handles the TDCH connection.
a In Gateway Host, type the name of the Knox Gateway host.

b In Gateway Port Number, type a port number to use to access the host.

c In Cluster Name, type the cluster name.

d In 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 you entered in the last step.
g [Optional] Click Test Connection to verify the connection is successful.

h Click Next.
TDCH connection properties are generated based on the Knox properties you enter
and display in the TDCH Connection Properties TDCH Connection Properties
screen. You cannot edit the TDCH connect properties.
13 [Optional] If you select to connect using TDCH and JDBC, complete step 10 and then
enter the connection credentials for JDBC.
a In 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.
d [Optional] Click Test Connection to verify the connection is successful.

e Click Next.

f In JDBC Host, type the host name of the Hadoop System to which to connect.
g In JDBC Port Number, type the port number to use to communicate with the host.

h In JDBC Database, type the name of the Hadoop database.

i In JDBC User Name, type the user name to use to connect to the database.
j In JDBC Password, type the password required to access the database using Hive
JDBC.
k Select Save Password to save the password you enter in the previous step.

l Select HTTP Transport Mode to transfer data using the HTTP secure transfer mode.

58 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

m In HTTP Path type the HTTP server path. The default value is cliservice.

n [Optional] Click Test Connection to verify the connection is successful.


14 Click Next.
A Summary of the information you entered in the previous steps displays.
15 Click Finish.
If the connection succeeds, the new Hadoop Hortonworks connection profile displays in
the Database Connections list in Data Source Explorer.

Creating Hadoop Hortonworks Connection Profiles Using JDBC


The Java Database Connectivity connection enables you to connect to a Hadoop
Hortonworks system using JDBC protocol to communicate to the Hadoop HiveServer2
subsystem.
1 Open the Data Source Explorer.
2 Right-click the Database Connections folder and select New.
You can also click in the main toolbar. The New Connection Profile wizard opens.
3 Under Connection Profile Types, select Hadoop Hortonworks.
4 Type a Name that helps you identify the connection profile definition easily.
5 [Optional] Type a brief Description for this specific Connection Profile definition.
6 Click Next.
7 In Connection Properties, select JDBC.
8 [Optional - not available in Studio Express] Select these additional connection options as
needed:

Connection Option Description


TDCH (Teradata Data Teradata Connector for Hadoop (TDCH) enables you to move data
Transfers) between Teradata Databases and Hadoop systems. Select this option
if you plan to transfer data between the Hortonworks Hadoop system
and a Teradata Database.
SQL-H (Hadoop to SQL-H enables you to transfer data from the Hortonworks Hadoop
Aster Data Transfers) System to an Aster Database. Select this option to transfer data from
Hortonworks Hadoop to Aster.

9 Specify when to connect by selecting one or both of these options:

Option Description
Connect when the wizard completes Connects immediately after you click Finish. This is
the default.
Connect every time the workbench is Connects each time you connect to your Eclipse
started workbench.

10 Click Next.

Teradata Studio User Guide, Release 15.10 59


Chapter 3 Database Connectivity

11 [Optional - not available in Studio Express] If you specify TDCH with JDBC, complete
the properties for the TDCH connection.
a In WebHDFS Host Name, type the host name or IP address of the system configured
to provide access to the Hadoop systems's distributed file system.
b In WebHDFS Port Number, type the port number to use to communicate with the
Hadoop system's WebHDFS service. For Hortonworks, this port is 50070 by default.
c In WebHDFS User Name, type the user name with permissions to access the
WebHDFS host.
d [Optional] Click Test Connection to verify the connection is successful.

e Click Next.
12 Specify the WebHCat properties.
WebHCat properties are required for JDBC and SQL-H connections. SQL-H connection
is not available in Studio Express.
a In 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.
d [Optional] Click Test Connection to verify the connection is successful.

e Click Next.
13 Specify the JDBC connection properties.

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.

e In JDBC Password, type the password required to access the database using Hive
JDBC.
f Select Save Password to save the password you enter in the previous step.
g Select HTTP Transport Mode to transfer data using the HTTP secure transfer mode.

h In HTTP Path type the HTTP server path. The default value is cliserver.

i [Optional] Click Test Connection to verify the connection is successful.


14 Click Next.
A Summary of the information you entered in the previous steps displays.

60 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

15 Click Finish.
If the connection succeeds, the new Hadoop Hortonworks connection profile displays in
the Database Connections list in Data Source Explorer.

Creating Hadoop Hortonworks Connection Profiles Using SQL-H


Aster SQL-H enables you to move data from a Hadoop system to Teradata Aster Database.
1 Open the Data Source Explorer.
2 Right-click the Database Connections folder and select New.
You can also click in the main toolbar. The New Connection Profile wizard opens.
3 Under Connection Profile Types, select Hadoop Hortonworks from the list.
4 Type a Name that helps you identify this Connection Profile definition.
5 [Optional] Type a brief Description for this specific Connection Profile definition.
6 Click Next.
7 In Connection Properties, select SQL-H.
8 [Optional] Select these additional connection options if needed:

Connection Option Description


Knox Gateway Select this option if you connect to the Hortonworks Hadoop system
through a Knox Gateway. If you select this option, you are not able to
select JDBC also.
TDCH (Teradata Data Select the Teradata Connector for Hadoop (TDCH) to move data
Transfers) between Teradata Databases and Hadoop systems.
JDBC (Creating and Select this option if you access the Hortonworks Hadoop system using
Running SQL) SQL from the SQL Editor. If you select this option, you are not able to
select Knox also.

9 Specify when to connect by selecting one or both of these options:

Option Description
Connect when the wizard completes Connects immediately after you click Finish. This is
the default.
Connect every time the workbench is Connects each time you connect to your Eclipse
started workbench.

10 Click Next.
11 If you specify only SQL-H, complete the following connection credentials:

a In 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.

Teradata Studio User Guide, Release 15.10 61


Chapter 3 Database Connectivity

c In WebHCat User Name, type the user name with permissions to access the
WebHCat host.
d [Optional] Click Test Connection to verify the connection is successful.
12 [Optional] If you specified TDCH and SQL-H, enter the WebHDFS properties for the
TDCH connection.
You are asked to complete the TDCH credentials first and then the SQL-H connection
credentials.
a In WebHDFS Host Name, type the host name or IP address of the system configured
to provide access to the Hadoop systems's distributed file system.
b In WebHDFS Port Number, type the port number to use to communicate with the
Hadoop system's WebHDFS service. For Hortonworks, this port is 50070 by default.
c In WebHDFS User Name, type the user name with permissions to access the
WebHDFS host.
d [Optional] Click Test Connection to verify the connection is successful.

e Click Next.

f Follow instructions in Step 10 to complete the SQL-H credentials.


13 [Optional] If you also specified JDBC, enter the credentials for the Hortonworks Hive
JDBC Driver.
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.

e In JDBC Password, type the password required to access the database using Hive
JDBC.
f Select Save Password to save the password you enter in the previous step.
g Select HTTP Transport Mode to transfer data using the HTTP secure transfer mode.

h In HTTP Path type the HTTP server path. The default value is cliservice.

i [Optional] Click Test Connection to verify the connection is successful.


14 Click Next.
A Summary of the information you entered in the previous steps displays.
15 Click Finish.
If the connection succeeds, the new Hadoop Hortonworks connection profile displays in
the Database Connections list in Data Source Explorer.

62 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

Foreign Servers
The Data Source Explorer displays the connections to foreign server objects. The foreign
server object contains the connection details to a remote database system. It also defines
associations with table operators that provide the ability to import and export data.
When you select a foreign server in the Foreign Server folder, the server details display in
the Object Viewer.

Foreign Server Form

Use the Foreign Server object form to create a foreign server and to associate table operators
with the server. The form enables you to create multiple server objects for the same remote
database and customize each server with different characteristics based on the server's
purpose.

Property Option Tabs


Click the property option tabs in the left panel to specify or view foreign server
properties in the right panel.

Foreign Server Properties


Select options in the left panel to create a foreign server, identify authorization and
security type, and associate name value pairs with table operators.
General Specify the name, host type, remote server, and port of the new
foreign server. You can edit the host type, remote server, and port after creating
the a foreign server. All fields are required to create the server.
Security Specify the security type and name for the authorization which
stores the credentials for the foreign server.

Teradata Studio User Guide, Release 15.10 63


Chapter 3 Database Connectivity

Using Pairs Specify the global name value pairs that the table operators use to
connect to this foreign server. Based on information you entered in the General
tab, using pairs display for the host type, remote server, and port.
Import Specify the local name value pairs to associate with the specified
IMPORT table operator.
Export Specify the local name value pairs to associate with the specified
EXPORT table operator.
SQL Review the generated CREATE FOREIGN SERVER or ALTER
FOREIGN SERVER statement that is based on the selections you make.

Action Bar
The action bar in the upper right corner enables these functions:
Commit Executes the SQL that creates or alters the foreign server. Commit is
disabled until you enter all required fields in the General tab.
Reset Clears all values entered in the form.

Creating a Foreign Server

To define a foreign server, you must have 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 Data Source Explorer, click the Foreign Servers node.
The Foreign Server tab appears in the Object Viewer.
2 Do one of the following:
In the Object Viewer toolbar, click (Create Foreign Server).
In the Data Source Explorer, right-click the Foreign Servers node and select Create
Foreign Server.
The Create Foreign Server form displays.
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 In Remote Server, type the DNS host name or IP address of the foreign server.

d In Port, type the port number the foreign server uses.


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.
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.

64 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

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 Name, type the name for the authorization.
5 Click Using 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. The pairs are global attributes of the server object.
To add or replace a name value pair, type a name in the Name column and the value
in the Value column, and click Add.
To remove a pair, select the name value pair and click Remove.
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.
The name value pairs that you create for importing data are local attributes of the
IMPORT table operator.
a In Database Name, 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.

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 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 Name, 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 creates the foreign server.
9 Click Commit to execute the generated DDL statement that creates the foreign server.

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.

Teradata Studio User Guide, Release 15.10 65


Chapter 3 Database Connectivity

1 In Data Source Explorer, click the Foreign Servers node.


The Foreign Server tab appears in the Object Viewer.
2 Do one of the following:
In the Object Viewer toolbar, click (Alter Foreign Server).
In the Data Source Explorer, right-click a foreign server name and select Alter
Foreign Server.
The Foreign Server form displays.
3 [Optional] Click General to edit foreign server information:
You cannot edit the name of the foreign server.
Host Type Change the type of the host.
Remote Server Change the DNS host name or IP address of the foreign server.
Port Change the port 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 this foreign server does not support associated credentials.
b In Authorization Name, change the name for the authorization.
5 [Optional] Click Using 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, type a name in the Name column and the value in the Value
column, and click Add.
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 Name, type the name of the database that contains the import table
operator.

66 Teradata Studio User Guide, Release 15.10


Chapter 3 Database Connectivity

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 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 Name, 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 the generated DDL statement that alters the foreign server.

Dropping a Foreign Server

1 In Data Source Explorer, click Foreign Servers.


The list of foreign servers displays in the Object Viewer.
2 In the Foreign Server tab, select the foreign server you want to delete.
You can select multiple foreign servers to drop at the same time.
3 Do one of the following:
In the Object Viewer toolbar, click (Drop Foreign Server).
In Data Source Explorer, right-click Foreign Servers and select Drop Foreign
Server.
4 Click Yes when prompted to confirm the DROP action.
The dropped foreign server disappears from the list.

Teradata Studio User Guide, Release 15.10 67


Chapter 3 Database Connectivity

68 Teradata Studio User Guide, Release 15.10


CHAPTER 4

Teradata Studio Workbench

Project Explorer
The Project Explorer provides a hierarchical view of the Projects you've created and their
resource files. You can use the Project Explorer to select SQL files for editing or create new
SQL files.
To open the Project Explorer, select Window > Show View > Project Explorer.

Data Source Explorer


The Data Source Explorer enables you to connect to a specific database system using a
Connection Profile and then view and manage the database objects in the connected system.
The database objects display in a navigation pane in which you can explore the structure of a
database's data and manage stored data sets. You can view a list of tables, macros, stored
procedures, views, and other objects in a selected database, and view additional details about
each object type. For example, from the Databases node you can expand a Tables node to
view a list of tables in a database, and the names and types of columns in the table.

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.

Teradata Studio User Guide, Release 15.10 69


Chapter 4 Teradata Studio Workbench

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 Loads all databases and the DBC user, but no other user objects.
DBC user)
Only Databases (but include Loads all databases, the DBC user, and the current user.
DBC 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
Hierarchical Display view. Option selected by default.
Include Database Indexes Folder Displays index objects in the Indexes folder. Option selected by
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 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
Folder Types 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.

70 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

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.

Actions
Use the action buttons at the bottom of the dialog to select, clear, apply, and save your
settings.
Option Description
Select All Click to select all options to load and display.
Clear All Click to clear your selections.
Restore Defaults Click to reset and restore default selections.
Apply Click to apply your changes.
OK Click 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 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
PermSpace configured.

Teradata Studio User Guide, Release 15.10 71


Chapter 4 Teradata Studio Workbench

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 Display hierarchical view. Option selected by default.
Include Database Indexes Displays index objects in the Indexes folder. Option selected
Folder by 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-
Functions Folder Defined 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.

Loading Teradata Databases to Data Source Explorer

You can add databases to display in the Data Source Explorer. The DBC database is always
loaded and does not need to be added.

72 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

1 In Data Source Explorer, right-click the Databases folder.


2 Select Teradata > Load Database.
The Add Database to DSE dialog appears.
3 Type the name of the database you want added in the Data Source Explorer hierarchical
tree.
4 Click Add.
5 Repeat steps 3 and 4 for each database you want to add.
6 Click Close.

Removing Teradata Databases in Data Source Explorer

You can remove databases in the Data Source Explorer (DSE) hierarchical tree.
1 In Data Source Explorer, right-click the name of the database to remove.
2 Select Teradata > Remove Database.
The selected database disappears from the DSE tree.

Setting Root of Data Source Explorer Display

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 DSE dialog appears.
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.

Object Viewer

About the Object Viewer

The Object Viewer provides detailed information about database objects you select either in
Data Source Explorer or in the Object Viewer. The Object Viewer automatically displays
when you select the Teradata Administrator perspective. To open it in a different
perspective, select Window > Show View in the menu toolbar.

Teradata Studio User Guide, Release 15.10 73


Chapter 4 Teradata Studio Workbench

You determine which objects display in the Object Viewer by setting preferences to
customize the viewer.

Data Source Explorer


Use the Data Source Explorer object tree to select objects to view in the Object
Viewer. Begin by connecting to a database and expanding the Data Source Explorer
object tree. To display object details in the Object Viewer, click an object in the
expanded tree.
Toolbar
The Object Viewer toolbar changes depending on the object you select.
Tabbed Object Views
Each object you select has a view tab labeled with the name of the object. Open the
tab to view object details and other related objects. For example, you can drill down
on a Database object to review details for Table, View, Macro, Procedure, and Index
objects. If you then drill down on the Table object, you are able to view Column,
Index, and Trigger objects.
To drill down and view details, click the object name displayed in Object Viewer or
select the object from the Data Source Explorer tree. A new tabbed view opens for
that object.
Object Details
Each object view in the Object Viewer displays detailed information about the
selected object and its elements. You can select the object from either the Data
Source Explorer tree or from a list of objects displayed in the Object Viewer.

74 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Opening the Object Viewer


The Object Viewer displays automatically when you open the Teradata Administrator
perspective. You also can open it from the Window menu or by right-clicking an object node
or object name in the Data Source Explorer.
Note: Before you open the Object Viewer, make sure you are connected to the database that
contains objects you want to view.
1. Select Window > Show View > Other > Object Viewer.
You can select any database object displayed in the Data Source Explorer tree. When
you select an object, object details display in the Object Viewer.
To open the Object Viewer from a selected object
1. Select an object in the Data Source Explorer that you want to view in the Object
Viewer.
2. Right-click the object and select Show in Object Viewer.
Detailed information about the object displays in Object Viewer.

Sorting in Object Viewer


Clicking a column header sorts all information in the table grid based on the order of
information in the column you clicked. Clicking the same column header reverses the sort
order.

Filtering Object Views


You can filter objects by name in the Object Viewer. This filter option is available when you
display existing objects for Databases, Indexes, Macros, Stored Procedures, Tables, User-
Defined Functions, and Views.
1 Select an object node, such as Tables, in Data Source Explorer tree.
A list of existing database objects displays in the Object Viewer.
2 Select one of the following options from the menu below the object tab name:

Option Description
Find Names that Type the starting characters of the object names you want to display.
Start with:
Find Names that Type the ending characters of the object names you want to display.
End with:
Find Names that Type characters used in the name of the objects you want to display. When
Contain: typing more than one character, do not use spaces and type characters in
the exact sequence they occur in the object name. The Object Viewer
filters on the occurrence of characters exactly as you type them. For
example, typing m or ma filters for words such as macro, but typing mr or
m r does not filter for the word macro.

The Object Viewer filters only for those names in the object list that match the name criteria
you specify.

Teradata Studio User Guide, Release 15.10 75


Chapter 4 Teradata Studio Workbench

Toolbar for Object Viewer


The Object Viewer toolbar contains action buttons to help you manage the database objects
that display in this view.

Actions
Click toolbar icons to perform tasks. You also can access actions from a drop-down menu.
Click at the right end of the toolbar to expand menu options.
Icon Menu Description
Pin Pins the selected object to the view.
Pinning an object means that the tabbed view for the
object is retained when you select another object to
display. When the pinned object view is selected, the
icon appears in a highlighted box.
Restore Tabs Refreshes the Object Viewer to display hidden tabs.
Tabs might be hidden as the result of filters.
Administer Profiles Opens the Administer Profiles - General Information
dialog to create or to modify user profiles.
Administer Roles Opens the Administer Roles - User Members dialog to
create new roles and to assign roles to users.
Show Interdependencies Opens the Interdependency Browser and shows the
interdependencies for the selected object.
Create Table Opens the Create Table - Table Columns Definition
dialog to create a Table object in the current database.
Create View Opens the Create View - View Query Specification to
create a new View object.
Create View of Table or Opens the Create View - Base View Definition to
View create a View object using the selected Table or View
object.
Modify Opens the Create View - View Query Specification to
edit View objects in the SQL Editor tab.
Create Macro Opens the Create Macro - Routine Parameters dialog
to create a Macro object in the current database.
Create Procedure Opens the Create Stored Procedure - Routine
Parameters dialog to create a Stored Procedure object
in the current database.
Create Trigger Opens the Create Trigger - Trigger Specification
dialog to create a Trigger object for the selected table.
Create a SQL User- Opens the Create User Defined Function - Routine
Defined Function Parameters dialog to create a User-Defined Function
(UDF) object in the selected database.

76 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Icon Menu Description


Create a SQL Structured Opens Create Structured User-Defined Type - User-
User-Defined Type Defined Type Attributes to create a Structured User-
Defined Type (UDT) object in the current database.
Action is available if you select a User-Defined Types
node in the Data Source Explorer.
Create a Distinct User- Opens Create Distinct User-Defined Type - Set User-
Defined Type Defined Type to create a Distinct User-Defined Type
(UDT) object in the current database. Action is
available if you select a User-Defined Types node in
the Data Source Explorer.
Create an Array User- Opens Create Array User-Defined Type - Set User-
Defined Type Defined Type to create an Array User-Defined Type
(UDT) object in the current database. Action is
available if you select a User-Defined Types node in
the Data Source Explorer.
Privileges Opens the Display, Grant, or Revoke Privileges dialog.
Use this dialog to specify privileges on the object as
well as define which users and roles have specific
Grant, Revoke, and Display privileges.
Edit Comments Opens the Edit Comment dialog and enables you to
type a comment to store with the object.
Create Database Opens the Create Database dialog to define a new
Database object that uses the selected database as the
parent database.
Create User Opens the Create User Base Information dialog to
define the name, password, and other information for
a new User object.
Clone User Opens the Clone User dialog to verify user
information and specify a name for the cloned User
object.
Modify User Opens the Modify User dialog in which you can edit
the information for the selected User object.
Modify Schema Opens the Modify Database dialog to enable you to
change the definition of an existing table.
Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.
Query Logging Opens the Query Logging Rules dialog to specify
query logging rules or to display existing rules.
Access Logging Opens the Access Logging Rules dialog to specify
access logging rules or to display existing rules.

Teradata Studio User Guide, Release 15.10 77


Chapter 4 Teradata Studio Workbench

Icon Menu Description


Logon Rights Opens the Grant, Revoke, and Display Logon Rights
dialog to grant, revoke, and display log-on privileges
assigned to database users.
Connect Through Rights Opens the Grant, Revoke, or Display Connect
Through Rights dialog to grant or revoke connect
through rights to or from objects and to grant
privileges for trusted users.
System Rights Opens the Grant, Revoke, or Display System Rights
dialog to specify the grant and revoke system rights to
objects and to define privileges on objects.
Column Rights Opens the Grant, Revoke, or Display Column Rights
dialog to specify the grant and revoke rights on all or
specific table columns and to define user privileges on
columns.

Use the Minimize and Maximize icons at the far right to resize the Object Viewer.

Setting Object Viewer Preferences


You can customize the display of the Object Viewer by opening Object Viewer Preferences
and selecting which types of objects you want shown in the viewer. By default all object types
are selected to display. The Object Viewer Preferences dialog allows you to select the types of
objects you want hidden by deselecting the check box next to the object name. You can use
the Restore Tabs action in the Object Viewer toolbar to restore object information that is
hidden. Clicking the Restore Tabs icon restores the tab options back to the default.
1 Select Window > Preferences > Teradata Datatools Preferences > Object Viewer
Preferences.
2 Select which objects to display by clicking the check box beside an object name.
To hide object information in the viewer, click a check box to clear the check mark.
3 Click OK.

About Viewing Objects

The Object Viewer shows information about the databases in the Connection Profile you
select to browse in the Data Source Explorer. Different information displays in the Viewer
depending on the type of object you select and whether you want to view summary
information or specific object details.
To view summary information about the objects in a database, open the Data Source
Explorer and select a node such as Databases, Tables, or Stored Procedures. The Object
Viewer displays information that lists the objects in that node with their properties.
To view detailed information about a specific object, click an object name displayed in the
Object Viewer object list or select the object from the Data Source Explorer tree. A new
tabbed view opens for that object.

78 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Viewing Objects in a Database


To view a list of objects in a database, open the Data Source Explorer and click a database
node, such as Databases, Tables, or Stored Procedures. The Object Viewer displays the
following information for the node you select:
Node Name Description For More Information
Databases Lists databases for the selected Connection Profile Database View
with information about fallback protection, journal
images, and database type.
Indexes Lists indexes in the database with information about Indexes View
the name of the index and type.
Macros Lists macro objects in the database with information Macros View
about access counts and dates, and name of the
creator.
Stored Lists stored procedure objects in the database with Stored Procedures View
Procedures information about parameter types, SQL data access,
access counts, and name of creator.
Tables Lists table objects in the database with information Tables View
about permanent disk space, journal table and
database, table creator, and if it is a queue table.
User-Defined Lists the user-defined function objects in the database User-Defined Functions
Functions with information about parameter and return types, View
SQL data access, access counts and dates, and object
creator.
Views Lists view objects in the database with comments. Views View

Databases View
The Databases tab displays a list of database objects defined in the Connection Profile
database. Double-click any name in the Database Name column to display information
about a specific database. The name of the connected database displays on the tab label
(database_name Databases). The view shows the following information:
Option Description
Database Name Name of the database.
Type Teradata Database type is a Database or User.
Fallback Indicates if the database has fallback protection by default for
tables created in this database.
Before Journal Type (if any) of before-change images maintained by default for
data tables created in the database. The values are No, Yes or
Dual.
After Journal Type (if any) of after-change images maintained by default for
data tables created in the database. The values are No, Yes, Local
or Dual.

Teradata Studio User Guide, Release 15.10 79


Chapter 4 Teradata Studio Workbench

Option Description
Comments Comments about the database.

Toolbar
Click the Databases node in the Data Source Explorer to display a list of users and
databases for the connected system. You can create new databases and users. New objects
display in both the Data Source Explorer tree and in the List of databases in the Object
Viewer.

Icon Menu Description


Pin Pins the selected object to the view.

Show Interdependencies Opens the Interdependency Browser and shows the


interdependencies for the selected object.
Create User Opens the Create User Base Information dialog to
define the name, password, and other information for
a new User object.
Create Database Opens the Create Database dialog to define a new
Database object that uses the selected database as the
parent database.
Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.

Indexes View
The Indexes tab contains a list of hash and join indexes defined in the selected database. You
can display index details by double-clicking an index name in the list. Index information
displays in a separate tabbed view.
Option Description
Index Name Name of the index.
Index Type Type of the index.
Comments Text description or comments about the index object.

Toolbar
Click an Indexes node to view a list of database indexes and their properties. If you click an
index name under an Indexes node, the toolbar options expand to include the following:

80 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Icon Menu Description


Pin Pins the selected object to the view.

Restore Tabs Refreshes the Object Viewer to display hidden tabs.


Tabs might be hidden as the result of filters.
Show Interdependencies Opens the Interdependency Browser and shows the
interdependencies for the selected object.
Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.
Edit Comments Opens the Edit Comment dialog and enables you to
type a comment to store with the object.
Privileges Opens the Display, Grant, or Revoke Privileges dialog.
Use this dialog to specify privileges on the object as
well as define which users and roles have specific
Grant, Revoke, and Display privileges.

Macros Tab
Double-clicking a Macros node in the Data Source Explorer displays a list of macros used
by the database in the Object Viewer.
Option Description
Macro Name Name of the macro.
Access Count Number of times the macro was accessed since the last counter
reset.
Last Access Date Date on which the macro was last accessed.
Creator Name Name of the creator of the macro.
Comments Text description or comments on the macro object.

Toolbar
Click a Macros node in the Data Source Explorer.

Icon Menu Description


Pin Pins the selected object to the view.

Show Interdependencies Opens the Interdependency Browser and shows the


interdependencies for the selected object.
Create Macro Opens the Create Macro - Routine Parameters dialog
to create a Macro object in the current database.

Teradata Studio User Guide, Release 15.10 81


Chapter 4 Teradata Studio Workbench

Icon Menu Description


Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.

Stored Procedures View


The Procedures tab in the Object Viewer contains a list of the stored procedures used in the
selected database. You can display information about an individual procedure by double-
clicking a procedure name in the list. The procedure object information displays in a separate
tabbed view.
Option Description
Procedure Name Name of the stored procedure.
Parameter Types Lists the types of parameters used by the procedure; for example,
INTEGER and VARCHAR(200).
Language Programming language used to write the procedure; for example,
SQL and JAVA.
SQL Data Access Type of SQL data access performed by the procedure; for example,
MODIFIES SQL DATA.
Access Count Number of times the procedure was accessed since the last counter
reset.
Creator Name Name of the creator of the procedure.
Comments Text description or comments about the procedure.

Toolbar
Click a Stored Procedures node in the Data Source Explorer.

Icon Menu Description


Pin Pins the selected object to the view.

Show Interdependencies Opens the Interdependency Browser and shows the


interdependencies for the selected object.
Create Procedure Opens the Create Stored Procedure - Routine
Parameters dialog to create a Stored Procedure object
in the current database.
Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.

82 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Tables View
The Tables tab lists the tables defined in the selected database. Double-clicking an entry
displays the details of the selected table in the Object Viewer.
The tab includes the following table information:
Option Description
Table Name Name of the database table.
Current Perm Amount of current permanent space usage of the table in bytes.
Peak Perm Amount of peak permanent space usage of the table in bytes.
Skew Factor Skew factor of the table. It indicates if the table row data is evenly
distributed on Teradata AMPs. If the data is skewed, some AMPs
have more rows and others have less. Skewing impacts the
performance of a Teradata Database.
Journal Table Database Name of the database that contains the journal table (if any) for
this table.
Journal Table Name of the journal table (if any) for this table.
Creator Name Name of the creator of the table.
Version Number of versions for the table.
Queue Values are Y (Yes) or N (No). Value indicates if this table is a
queue table.
Fallback Values are Y (Yes) or N (No). Value indicates if this table is
enabled for Fallback operations.
No Pi Values are Y (Yes) or N (No). Value indicates whether the table is a
"No Primary Index" table or not.
Last Access Date Date on which the table was last accessed.
Access Count Number of times the table was accessed since the last counter
reset.
Comments Comments about the table.

Toolbar
The toolbar options let you create a new table and create views for tables or views.

Icon Menu Action Description


Pin Pins the selected object to the view.

Show Interdependencies Opens the Interdependency Browser and shows the


interdependencies for the selected object.

Teradata Studio User Guide, Release 15.10 83


Chapter 4 Teradata Studio Workbench

Icon Menu Action Description


Create Table Opens the Create Table - Table Columns Definition
dialog to create a Table object in the current database.
Create View Opens the Create View - View Query Specification to
create a new View object.
Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.

User-Defined Functions View


The User-defined Functions view lists the function names and other information about the
user-defined functions defined in the selected database. Double-click an entry to display the
details of the selected function in the Object Viewer.
The UDFs tab includes the following information:
Option Description
Function Name Name of the user-defined function.
Specific Name Specific name of the user-defined function.
Return Types] Type of the value returned from the user-defined function.
Parameter Types Comma-separated list of the types of the parameters in the user-
defined function.
Language Language in which the procedure is written. This could be SQL, C
or Java.
SQL Data Access The user-define function's SQL data access.
Access Count Number of times the function was accessed since the last counter
reset.
Last Access Date Date that the user-defined function was last accessed.
Creator Name Name of the creator of the user-defined function.
Comments Comments about the user-defined function.

User-Defined Function Types Actions


Click a User-Defined Function Types node in the Data Source Explorer.

Icon Menu Description


Pin Pins the selected object to the view.

Show Interdependencies Opens the Interdependency Browser and shows the


interdependencies for the selected object.

84 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Icon Menu Description


Create a SQL Structured Opens Create Structured User-Defined Type - User-
User-Defined Type Defined Type Attributes to create a Structured User-
Defined Type (UDT) object in the current database.
Action is available if you select a User-Defined Types
node in the Data Source Explorer.
Create a Distinct User- Opens Create Distinct User-Defined Type - Set User-
Defined Type Defined Type to create a Distinct User-Defined Type
(UDT) object in the current database. Action is
available if you select a User-Defined Types node in
the Data Source Explorer.
Create an Array User- Opens Create Array User-Defined Type - Set User-
Defined Type Defined Type to create an Array User-Defined Type
(UDT) object in the current database. Action is
available if you select a User-Defined Types node in
the Data Source Explorer.
Drop Opens the Drop Confirmation dialog which prompts
you to confirm the drop of the selected object from
the database.

Views View
The Views tab contains a list of views defined in the selected database.
Option Description
View Name Name of the view.
Comments Text descriptions or comments about the view.

Toolbar
Click a Views node in the Data Source Explorer. Use the toolbar to create a new view,
modify an existing view, or create a view based on an existing view or table.

Icon Menu Description


Create View Opens the Create View - View Query Specification to
create a new View object.
Create View of Table or Opens the Create View - Base View Definition to
View create a View object using the selected Table or View
object.
Modify Opens the Create View - View Query Specification to
edit View objects in the SQL Editor tab.

Teradata Studio User Guide, Release 15.10 85


Chapter 4 Teradata Studio Workbench

Viewing Object Details


To view object details, click an object name listed in an Object Viewer object summary or
select the object from the Data Source Explorer navigation pane. A new tabbed view opens
for that object.
Object Type Description
Database Select a specific database to view details about tables, macros,
procedures, indexes, jars, UDFs, system rights (and more) defined
in the selected database.
Macro Select a macro to view details about parameters, users, privileges,
and other details.
Procedure Select a stored procedure to view information about the object
such as parameter types, SQL data access, creator, and access
count.
Table Select a table to view a list of columns, data types, access counts,
data formats, character sets, and more.
User-Defined Function Select a user-defined function to view a list of parameters used by
the function, users and privileges, SQL executed to create the
function, and other details.
View Select a specific view to view details about columns, SQL,
privileges, users, column rights, references (and more) defined for
the selected view.

Database Object Tab


The Object Viewer opens a tabbed view for each database object you select in Data Source
Explorer under the Databases node or when you double-click a database name displayed in
the Databases tab of the Object Viewer.
The name of the selected Database or User object displays on the tab label (Database
<object_name>).

User Information Tab


The User Information tab only displays when you select a User object under the Databases
node or from the database list in the Databases tab.
Option Description
Attribute Property or characteristic of the selected User. For example, User Name, Startup String,
and Default Database are attributes associated with a User object.
Value Value assigned to the attribute, such as "HOST" to the Default Collation attribute.

Tables Tab
The Tables tab contains a list of tables defined in the selected Database/User. You can display
table details by double-clicking a table name in the list. Table information displays in a
separate tabbed view.

86 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Table Name Name of the database table.
Current Perm Amount of current permanent space usage of the table in bytes.
Peak Perm Amount of peak permanent space usage of the table in bytes.
Skew Factor Skew factor of the table. It indicates if the table row data is evenly
distributed on Teradata AMPs. If the data is skewed, some AMPs have
more rows and others have less. Skewing impacts the performance of a
Teradata Database.
Journal Table Name of the database that contains the journal table (if any) for this table.
Database
Journal Table Name of the journal table (if any) for this table.
Creator Name Name of the creator of the table.
Version Number of versions for the table.
Queue Values are Y (Yes) or N (No).
Fallback Values are Y (Yes) or N (No). Value indicates if this table is enabled for
Fallback operations.
No Pi Values are Y (Yes) or N (No). Value indicates whether the table is a "No
Primary Index" table or not.
Last Access Date Date on which the table was last accessed.
Access Count Number of times the tables was accessed since the last counter reset.
Comments Comments about the table.

Macros Tab
The Macros tab contains a list of the macros used in the selected Database/User object. You
can display macro details by double-clicking a macro name in the list. Macro information
displays in a separate tabbed view.
Option Description
Macro Name Name of the macro.
Access Count Number of times the macro was accessed since the last counter reset.
Last Access Date Date on which the macro was last accessed.
Creator Name Name of the creator of the macro.
Comments Text describing or commenting on the macro object.

Procedures Tab
The Procedures tab contains a list of the stored procedures used in the selected Database/
User object. You can display procedure details by double-clicking a stored procedure name
in the list. The Stored Procedure object information displays in a separate tabbed view.

Teradata Studio User Guide, Release 15.10 87


Chapter 4 Teradata Studio Workbench

Option Description
Procedure Name Name of the stored procedure.
Parameter Types Lists the types of parameters used by the procedure; for example, INTEGER and
VARCHAR(200).
Language Programming language used to write the procedure; for example, SQL and JAVA.
SQL Data Access Type of SQL data access performed by the procedure; for example, MODIFIES
SQL DATA.
Access Count Number of times the procedure was accessed since the last counter reset.
Creator Name Name of the creator of the procedure.
Comments Text describing or commenting on the corresponding Macro object identified by
the Macro Name.

Indexes Tab
The Indexes tab contains a list of hash and join indexes defined in the selected database. You
can display index details by double-clicking an index name in the list. Index information
displays in a separate tabbed view.
Option Description
Index Name Name of the index.
Index Type Type of the index.
Comments Text describing or comments about the index object.

Jars Tab
The Jars tab contains a list of JARs defined in the selected database. You can display JAR
details by double-clicking the Jar ID in the list. JAR information displays in a separate tabbed
view.
Option Description
Jar ID Unique identifier for the JAR file.
Java Routine References Number of Java routines that reference the JAR file.
References Jar Count Number of other JAR files referenced by this JAR file.
Referenced By Jar Count Number of JAR files that reference this JAR file.

UDFs Tab
The UDFs tab contains the list of user-defined functions used in the selected database.
Double-click a function name to display information about individual functions. Details
display in a separate tabbed view.
Option Description
Function Name Name of the user-defined function.
Specific Name Specific name of the user-defined function.

88 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Return Types] Type of the value returned from the user-defined function.
Parameter Types Comma-separated list of the types of the parameters in the user-defined function.
Language Language in which the procedure is written. This could be SQL, C or Java.
SQL Data Access The user-define function's SQL data access.
Access Count Number of times the function was accessed since the last counter reset.
Last Access Date Date that the user-defined function was last accessed.
Creator Name Name of the creator of the user-defined function.
Comments Comments about the user-defined function.

Privileges Tab
The Privileges tab contains a list of Users who are granted privileges to the selected
database.
Option Description
User Name of the User.
Privilege Type of privilege granted, such as Create User or Drop View.
Grantable Checkmark indicates the User is able to grant the privilege to others.
Grantor Name of the User that grants the privilege.

Systems Rights Tab


The System Rights tab contains the list of users that have system rights to the selected User
database object. It identifies the type of privilege granted and shows whether the user can
grant the privilege to others.
Option Description
Object Name of database object which has system rights.
Privilege Type of privilege granted.
Grantable Check mark indicates whether privilege can be granted to others.

Query Logging Tab


The Query Logging tab contains the list of Users that log queries on the selected User
database object.
Option Description
User Name Name of the user set up for query logging.
Account String Name of account that defines the logon sessions for the user.
Appl Name Name of application set up for query logging.
SQL Length Length of the SQL stored in the main query logging table: DBQLLogTbl.

Teradata Studio User Guide, Release 15.10 89


Chapter 4 Teradata Studio Workbench

Option Description
Rule Type Type of logging rule that applies to the application, user, or account.
What is Logging Summary statistics.

Access Logging Tab


The Access Logging tab contains the list of Users that access the selected database. This
information displays only when you select a User database.
Option Description
User Name of user for which access logging is set.
Database Name of database on which access logging runs on objects in that database.
Object Name of object in the database set up for access logging.
Type Type of access logging, such as Select or Insert.
Access Number of times access to the object is successful.
Denials Number of times access to the object is denied.

Rights Held By Tab


The Rights Held By tab in the Object Viewer contains information about rights held by a
Database or User and describes the objects to which the rights apply.
Option Description
Database Name of the database to which the right applies or which contains the table to which
the right applies.
Object Name of the object to which the right applies if a table-level right.
Column Name of the column to which right applies if a column-level right.
Access Right One or two-character code for each access privilege the user owns for this database,
table, or column.
Grant Role Indicates if the user has authority to grant this right to others ( Y for yes or N for no).
If the right is held directly by a user, it is Y or N. If the right is granted through role
membership, the Role Name displays.
Grantor Name of the user who granted this access privilege.
Allness Flag Indicates whether the right is automatically propagated to databases created below
this user.
Y - Right is automatically propagated
N - Right is not automatically propagated

Column Rights Tab


The Column Rights tab contains a list of usernames with column rights for the selected
Table object. You can display details by double-clicking a UserName in the list. The
information displays in a separate tabbed view.

90 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
User Name Name of the user who has column rights for columns in the selected table.
Database Name Name of the database that contains the table with column rights.
Table Name Name of table in the database on which user has column rights.
Column Name Name of the column in the table for which the user has rights.
Privilege Type of privilege granted.
Grantable Check mark indicates that the user has rights to grant the privilege to others.

Stored Procedure Object Tab


Select a stored procedure object in the Data Source Explorer or from the Stored Procedures
summary list in the Object Viewer to display its elements in a separate tabbed view.

Parameters

Option Description
Position Position in the procedure where the parameter is
declared. Positions are indicated by numeric
values, such as 1, 2, 3, and indicate the relative
order of the parameter in relationship to other
parameters declared by the procedure.
Name Name of the parameter.
Parameter Type Data type of the parameter.
Mode Mode of the parameter. Values are IN and
INOUT.
Comments Comments about the parameters in the
procedure object.

Details
The Details tab displays the attribute information for the selected table, such as name, and
the value for that attribute.
Option Description
Attributes Property or characteristic of the table. Attributes
include:
Value Value associated with the attribute, such as the
specific alphanumeric characters assigned as its
name.

Attributes are:
Option Description
Name Name of the stored procedure object.

Teradata Studio User Guide, Release 15.10 91


Chapter 4 Teradata Studio Workbench

Option Description
Parameter Type Lists the types of parameters used by the
procedure; for example, INTEGER and
VARCHAR(200).
Language Programming language used to write the
procedure; for example, SQL and JAVA.
SQL Data Access Type of SQL data access performed by the
procedure; for example, MODIFIES SQL DATA.
Comments Comments about the parameters in the
procedure object.

SQL
The SQL tab shows the SQL statements that executes to create the object. You cannot edit the
SQL that displays.

Privileges
The Privileges tab contains a list of Users who are granted privileges on the selected stored
procedure.
Option Description
User Name of the User.
Privilege Type of privilege granted, such as Drop
Procedure and Execute Procedure.
Grantable Check mark indicates the User is able to grant the
privilege to others.
Grantor Name of the User that grants the privilege.

Users
The Users tab contains a list of the users for the selected procedure. You can display details by
double-clicking a User in the list. The information displays in a separate tabbed view.
Option Description
User Name of the user.

Macro Object Tab


Select an object listed in the Macros node in Data Source Explorer to view a list of macros in
the selected database. You can view information about a specific macro by double-clicking
the name of a macro in the list. Detailed information about the macro displays in the Object
Viewer. You can open more than one macro view at the same time. The macro name displays
in the tab label.

Parameters Tab
Callable macros may have parameters. The Parameters tab lists any parameters used by a
macro and the position where they are declared in the macro.

92 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Position Position in the macro where the parameter is declared.
Name Name of the parameter.
Parameter Type Data type of the parameter.
Comments Comments about the parameter.

Details Tab
The Details tab lists attributes for the macro, such as name, and the value for that attribute.
Option Description
Attributes Property or characteristic of the macro object, such as Name.
Value Value associated with the attribute, such as the specific alphanumeric characters
assigned as its name.

SQL Tab
The SQL tab displays the SQL code used to create the macro.

Privileges Tab
The Privileges tab lists the users who are granted privileges to use the macro and describes
the type of privilege and which user granted it.
Option Description
User Name of user or database granted privileges on the macro.
Privilege Type of privilege granted; for example, Execute.
Grantable Check mark indicates user can grant macro privileges to others.
Grantor Name of user or database that granted the privilege.

Users Tab
The Users tab lists the databases that use the macro.
Option Description
User Name of the database that uses the macro.

Table Object Tab


Select an object in the Tables node in Data Source Explorer to view detailed information
about the table. The name of the selected table displays in the tab title.
Option Description Topic
Columns Lists the columns in the table Table Columns Tab.
and their properties such as
data type, format, and last
access date.

Teradata Studio User Guide, Release 15.10 93


Chapter 4 Teradata Studio Workbench

Option Description Topic


Details Displays the table attributes Table Details Tab.
such as skew factor, journal
database, and current and peak
permanent space usage.
Indexes Displays information about the Table Indexes Tab.
indexes defined for the table
such as whether it's a primary or
secondary index and the index
type.
Constraints Contains information about Table Constraints Tab.
constraints defined for the
selected table.
Triggers Contains information about the Table Triggers Tab.
triggers defined for the selected
database table.
References Lists objects which reference the Table References Tab.
table.
Space User Provides statistics about current Table Space Use Tab.
and peak permanent space
usage for the table.
SQL Shows the SQL statements that SQL Tab.
executes to create the table
object.
Privileges Lists users and privilege granted Table Privileges Tab.
for the table object.
References Lists database and object names Table References Tab.
that reference the table and the
type of reference.
Statistics Provides information about Table Statistics Tab.
unique values and where they
are located.
Users Lists the databases/users of the Table Users Tab.
table.
Column Rights Lists the user names with Table Column Rights Tab.
column rights for the selected
Table object.

Columns Tab
The Columns tab that displays in the Object Viewer shows information about columns in a
database table object. This information is available when you select a table object from the
Data Source Explorer, on page 69 or from a list of tables in the Object Viewer.

94 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Position Position in the table where the column is
declared. The position is a numeric value that
indicates the relative position of the column to all
columns in the table. For example, position 1 is
the first column in the table.
Name Name of the column.
Type Data type of the column.
Access Count Number of times the object was accessed since
the last counter reset.
Last Access Date Date on which data in the column was last
accessed.
Format Default display format for the data in the
column; for example, if a date format, YYY-MM-
DD-HH:MI:SS.
Nullable Null code indicating whether the column can
have a null value or not:
Y - Yes
N - No
Char Set Type of character set; for example, LATIN or
UNICODE.
Default Value Any default value assigned to the column.
Column Title Column header associated with the column.
Comments Comments about the column.

Details Tab
The Details tab displays the attribute information for the selected table, such as name, and
the value for that attribute.
Attribute Description
Name Name of the table
Current Perm Current perm space usage of table in bytes
Peak Perm Peak perm space usage of table in bytes
Skew Factor Indicates if the table row data is evenly
distributed on Teradata AMPs. If the data is
skewed, some AMPs have more rows and others
have less. Skewing impacts the performance of a
Teradata Database.
Journal Table Database Name of database that contains the journal table
(if any) for the table

Teradata Studio User Guide, Release 15.10 95


Chapter 4 Teradata Studio Workbench

Attribute Description
Journal Table Name of the journal table (if any) for the table
Comments Comments about the table

Indexes Tab
The Table Indexes tab contains information about the indexes defined for the table. The tab
body has two sections. To display information in the Index Columns section, you must select
an index in the Table Indexes section.

Table Indexes
The Table Indexes section lists the indexes defined for the table. It contains the following
information:
Option Description
Name Name of the index. This field is blank if the index
is not given a name.
Index Type Type of the index. This field shows whether the
index is Unique or Nonunique and a Primary
Index or Secondary index.
Columns Comma-separated list of the names of the
columns that make up the index.

Index Columns
The Index Columns section displays the columns of the table that make up the index
selected in the Table Indexes section. It contains the following information:
Option Description
Name Name of the column that is a member of the
index.
Type Data type of the column; for example, BYTE(4).
Index Number Internal index number.
Access Count Number of times index column was accessed
since last counter reset.
Last Access Date Date on which the index column was last
accessed.
Comments Comments about the index column.

Constraints Tab
The Table Constraints tab contains information about the constraints defined for the
selected table. The tab body has two sections.

Table Constraints
The Table Constraints section lists the constraints defined for the table. It contains the
following information:

96 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Name Name of the constraint. This field is blank if the
constraint is not given a name.
Constraint Type Type of index that dictates the constraints:
Primary Key or Foreign Key.

Constraint Details
This section contains information about the constraint selected in the Table Constraints
section. It consists of two columns: Attribute and Value. The attributes of a constraint are
different depending on whether you select Primary Key or Foreign Key in the Constraint
Type column in the section above.

Primary Key
A primary key is the designated attribute in a table where unique values are used to
identify each row in the table. A primary key must not be null, have no duplicate values, and
only one primary key per table.
If Primary Key is the table constraint type, the following fields display:
Attribute Field Description of Value
Name Name of the constraint. This field is blank if the
constraint is not given a name.
Member Column Name and type of the column that is a member
of the primary key. There is a Member Column
field in the Constraint Details part of the tab for
each column that is part of the table primary key.

Foreign Key
A foreign key is one or more attributes in a table that relate to a primary key in another
table. A foreign key cannot have a non-null value without a corresponding value in the
primary key table. Duplicate values are allowed, and null values are allowed. A table can
have zero or more foreign keys. If Foreign Key is the table constraint type, the following
fields display:
Option Description
Name Name of the constraint. This field is blank if the
constraint is not given a name.
Referenced Table Name of the table that is referenced by the
Foreign Key. Double-clicking on this entry in the
details displays the referenced table in the Object
Viewer. For example
ARP_AAA1.ARPTBL_IT005 where ARP_AAA1
is the database name and ARPTBL_IT005 is the
table name.

Teradata Studio User Guide, Release 15.10 97


Chapter 4 Teradata Studio Workbench

Option Description
Referenced Index Name of the index in the referenced table that
the Foreign Key columns reference. Double-click
this entry in the details to display the referenced
index in the Object Viewer.
Referenced Constraint Not used.
Column Association This field is repeated for each column in the
Foreign Key constraint; for example, if there are
two columns, there is a Column Association1,
and Column Association2. The entry in the
Value column shows the name and type of the
column in the table followed by "->" and the
name and type of the column in the referenced
table that the column references. For example,
f1 SMALLINT ->
ARP_AAA1.ARPTBL_IT005.f1
SMALLINT The referenced column name is
given in the form database name.table
name.column name.

Triggers Tab
The Triggers tab contains information about the triggers defined for the selected database
table. Double-click an entry in the Trigger Name list to display information in the Object
Viewer about the selected trigger. The following information displays for each trigger object
you select.
Option Description
Trigger Name Name of the trigger.
Enabled Indicates if the trigger is enabled or disabled.
Action Time Indicates if the trigger runs before or after the
action shown in the Action Type column.
Action Type Indicates which action on the table causes the
trigger to run: UPDATE, INSERT. DELETE.
Granularity Indicates if the trigger code runs per statement or
per each affected row.
Order Order setting for the trigger. If no order was
specified for the trigger, the default value of
32767 is used.
Comments Comments about the trigger.

Space Use Tab


The Space Use tab displays information about the amount of disk space used by the selected
table and provides statistics on current and peak usage.

98 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
VPro VProc number
Current Perm Current permanent space usage for the table object measured in bytes.
Peak Perm Peak permanent space usage for the table object measured in bytes.

SQL Tab
The SQL tab shows the SQL statements that executes to create the object. You cannot edit
the SQL that displays.
Privileges Tab
The Privileges tab contains a list of Users who are granted privileges on the selected
database.
Option Description
User Name of the User.
Privilege Type of privilege granted, such as Create User or
Drop View.
Grantable Check mark indicates the User is able to grant
the privilege to others.
Grantor Name of the User that grants the privilege.

References Tab
The References tab shows all views and macros that directly reference the selected table. The
References tab does not show indirect references to tables or views, such as when a macro
calls a view that is based on a table or another view. This lower-level table or view does not
display in the references report. The tab contains the following information:
Option Description
Database Name Name of database in which the reference object is
defined.
Object Name Name of the reference object.
Type Data type of the reference object.

Note: This feature is only available for users who have SELECT access on the dbc.DBase,
dbc.TVM, and dbc.TextTbl tables.
Statistics Tab
The Statistics tab displays statistics for unique values found in columns.
Option Description
Date Date statistic was collected.
Time Time statistic was collected.
Unique Values Unique values found.

Teradata Studio User Guide, Release 15.10 99


Chapter 4 Teradata Studio Workbench

Option Description
Column Names Name of column in which it was found.

Users Tab
The Users tab contains a list of the users for the selected Table object. You can display details
by double-clicking a User in the list. The information displays in a separate tabbed view.
Option Description
User Name of the user.

Column Rights Tab


The Column Rights tab contains a list of user names with column rights for the selected
Table object. You can display details by double-clicking a User Name in the list. The
information displays in a separate tab view.
Option Description
User Name Name of the user who has column rights for
columns in the selected table.
Database Name Name of the database that contains the table with
column rights.
Table Name Name of table in the database on which user has
column rights.
Column Name Name of the column in the table for which the
user has rights.
Privilege Type of privilege granted.
Grantable Check mark indicates that the user has rights to
grant the privilege to others.

UDF Object Tab


Select a user-defined function object in the Data Source Explorer or from the User-defined
Function list in the Object Viewer to display its elements in a separate tabbed view. The view
consists of the following tabbed information:

Parameters Tab
Option Description
Position Position within the function where the parameter
is declared. Positions are indicated by numeric
values, such as 1, 2, 3, and indicate the relative
order of the parameter in relationship to other
parameters declared by the function.
Name Name of the parameter.
Parameter Type Data type of the parameter.

100 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Comments Comments about the parameter.

Details Tab
Option Description
Attribute Description of option.
Value Description of option.

SQL
The SQL tab shows the SQL code used to create the object.

Source
The Source tab shows the external source of the user-defined function.
Option Description
Source Text box contains the source code for the
function.

Privileges Tab
Option Description
User Name of the database that runs the function.
Privilege Name of the privilege, such as Execute Function
or Drop Function.
Grantable Checkmark indicates the privilege can be granted
to others.
Grantor Name of the database that granted the privilege.

User
The User tab contains a list of the user databases that run the function.
Option Description
User Name of the User database that uses the user-
defined function.

View Object Tab


Select an object in the Views node in Data Source Explorer to display detailed information
about the view. You can also select the view object from a Views summary list in the Object
Viewer. The name of the selected view displays in the tab title.

Columns Tab
The Columns tab lists the columns defined in the selected View.

Teradata Studio User Guide, Release 15.10 101


Chapter 4 Teradata Studio Workbench

Option Description
Position Position of the column in the view. The first
column in the view is position 1; the second
column is position 2, and so forth.
Name Name of the column.
Type Data type of values in the column.
Comments Comments about the view column.

Details Tab
The Details tab lists attributes for the view, such as View Name, and the value for that
attribute.
Option Description
Attribute Property or characteristic of the view object, such
as View Name and Comments.
Value Value associated with the attribute, such as the
specific alphanumeric characters assigned as its
name.

SQL Tab
The SQL tab displays the SQL code used to create the view.

Privileges Tab
The Privileges tab lists the users granted privileges to use the view and describes the type of
privilege and which user granted it.
Option Description
User Name of user or database granted privileges on
the view.
Privilege Type of privilege granted; for example, Insert,
Delete, Drop View, or Update.
Grantable Check mark indicates user can grant view
privileges to others.
Grantor Name of user or database that granted the
privilege.

References Tab
The References tab lists the databases and objects that the view references.
Option Description
Database Name Database name of the object that the view
references.
Object Name Name of the object that the view references.

102 Teradata Studio User Guide, Release 15.10


Chapter 4 Teradata Studio Workbench

Option Description
Type Reference type name.

Users Tab
The Users tab lists the databases that use the view.
Option Description
User Name of the database/user that uses the view.

Teradata Studio User Guide, Release 15.10 103


Chapter 4 Teradata Studio Workbench

104 Teradata Studio User Guide, Release 15.10


CHAPTER 5

Administration of Teradata Databases

Data Utilities

Data Utilities Preferences

Disk Cache
These settings apply to both Teradata Database and Aster Database.
Option Description
Root Directory Specify the root directory location. Accept the default
location or click Browse to specify a different
directory path.
File Extension Default is the .dat file extension. Accept the default
extension or type a different file extension.
File Encoding Select the file encoding standard you want used when
caching data.
Cache Threshold Default maximum cache size is 8192. To change the
cache threshold, type a new value.
Transaction Commit Size (rows) Default is the application default. Specify the number
of rows by selecting a number in the list or typing a
numeric value in the field.
Error File Path Of Smart/Fast Load Click Browse to select a file for SmartLoad and Fast
Load errors.

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.

Teradata Studio User Guide, Release 15.10 105


Chapter 5 Administration of Teradata Databases

Administration Dialogs

Administer Profiles

The Administer Profiles dialog enables you to create or modify user profiles. You must have
the CREATE PROFILE privilege to create a profile.
1. Under General Information in Profile Name, type a new profile name or select an
existing profile from the list.
2. Click any of the Administrator Profile tabs and complete the information. This
information automatically generates an SQL DDL statement that you can preview and
run in the SQL Preview tab.

Administer Profile Tabs


The Administer Profile dialog contains the following four tabs:
Tab Description
General General information about the user profile.
Password Password information for the user profile.
Query Bands Query band setup for administering profiles.
Users In Profile Users assigned to the profile.
Preview SQL generated for the profile. Specify whether you want to run the
SQL to create the user profile, save the generated SQL to a file, or save
the SQL DDL statements to the SQL Editor for further editing.

About User Profiles


User profiles provide configuration settings for users assigned to the profile. If no settings are
selected, 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 a User Profile


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.

106 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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
defined for the affected 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.

General
The General tab enables you to manage information related to a database profile. You can:
Identify an account to charge for space usage.
Specify the default database to use.
Specify maximum allocation usage for spool and temporary space per user.
Write comments that assist management of the database and space usage.
Option Description
Account ID Identification (ID) for the account to be charged for the space used
by users with this profile. If the account ID is not defined in the
profile assigned to a user, Teradata Database uses the setting
defined for the individual user. The Account ID value must follow
the standard Teradata Database naming rules. You must separate a
list of account IDs by commas and enclose with left parenthesis
and right parenthesis characters. Accounts in a profile assigned to
a user override any accounts the user might have.
Default Database Selects the default database from the drop down list. If the default
database is not defined in the profile assigned to a user, Teradata
Database uses the setting defined for the individual user.
Spool Space The spool space for the profile. This is the maximum number of
bytes of spool space that can be used by any user who is assigned
to this profile. If the spool space is not defined, the Teradata
Database uses the setting defined for the individual user.
Temporary Space The temporary space for the profile. This is the maximum number
of bytes that can be used by temporary tables created by any user
who is assigned to this profile. If the temporary space is not
defined, the Teradata Database uses the setting defined for the
user.
Comment [Optional] Comments about the profile. Comment text is limited
to 255 characters.

Users In Profile
The Users In Profile tab enables you to assign users to a user profile. It consists of two
panels.
Panel Description
All Users Lists all users in the database.

Teradata Studio User Guide, Release 15.10 107


Chapter 5 Administration of Teradata Databases

Panel Description
Users in Profile Lists users in the database who are assigned to the profile. If you are
creating a new profile, the Users in Profile list is empty.

Note: You must have the CREATE PROFILE privilege to create a profile and the CREATE
USER or MODIFY USER privilege to add or remove users in the profile.
1 From the All Users list, select the users to assign to the profile and move them to the
Users in Profile list using the directional arrows.
The single arrow moves a single user; the double arrow moves multiple users.
2 Click the SQL Preview tab to view the generated SQL DDL statement.
When you add a user to a profile, a MODIFY USER AS PROFILE statement is generated
in the SQL Preview tab.

Password
The Password tab enables you to define the password settings for a database profile. The
password security attributes you define in this dialog take effect the next time the user logs
on.
Field Description
Minimum Length Minimum number of characters required for the password. This value
must be between 1 and 30.
Maximum Length Maximum number of characters allowed for the password. This value
must be between 1 and 30.
Expiration (days) Number of days allowed to elapse before the password expires. A value of
0 (zero) indicates the password never expires.
Maximum Log On Number of maximum log-on attempts allowed before locking the user
Attempts from further attempts. A value of 0 (zero) indicates to never lock the user.
Reuse (days) Number of days allowed to elapse before a password can be reused.
Locked User (minutes) Number of minutes to elapse before unlocking a locked user. Or select
Unlock Immediately to unlock the user immediately, or select Lock User
Indefinitely to lock the user indefinitely.
Allow User Name Allows the user name to be contained within the password. The default is
to not allow characters in a user name to be used in the password.
Note: If you select this option, then the alpha characters, special
characters, and mixed case characters options are automatically selected.

Search for Restricted Allows certain words to be restricted from use in a password. If checked,
Words any words listed in the DBC.PasswordRestrictions database view
cannot be used in the password.
Note: This feature is only available when you connect to a Teradata
Database 12.00.00 and later.

Digits Select an option:

108 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Field Description
Allowed - Allows digits in the password, but they are not required.
Not Allowed - No digits allowed in the password.
Required - Requires at least one digit in the password.
Special Characters Special characters are only pound sign (#), dollar sign ($), and
underscore (_), unless the password is enclosed in double quotes, in
which case other special characters can be used. Select an option:
Allowed - Allows special characters in the password, but they are not
required.
Not Allowed - No special characters allowed in the password.
Required - Requires at least one special character in the password.
Alpha Characters Select an option:
Allowed - Allows alphabetic characters in the password.
Required - Requires at least one alphabetic character in the password.
Mixed Case Characters Select an option:
Allowed - Allows a password to contain a mix of upper and lower-
case characters.
Required - Requires that the password be a mix of upper and lower-
case characters.
Clear Password Options Clears all password values in the dialog to NULL. Clearing password
options causes the Teradata Database to use the system settings for users
assigned to the profile.

SQL Preview
The SQL Preview tab displays the generated SQL CREATE PROFILE, CREATE USER AS
PROFILE, and MODIFY USER AS PROFILE statements required to create profiles and add
users to the profile. 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 DDL statements and verify that the
definition is accurate.
2 [Optional] Click any Administer Profiles tab to change the profile attributes 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 Click 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.
Run SQL Executes the SQL. This actions resets the Administer Profiles dialog.

Teradata Studio User Guide, Release 15.10 109


Chapter 5 Administration of Teradata Databases

Option Description
Show in Editor Displays the SQL statement in the SQL Editor. To edit the SQL, you must close
the Administer Profiles dialog.

Create Authorization

Authorizations make an association between a database user and an operating system server
user identification, allowing an external routine to run in secure mode using the context,
privileges, and access control accrued to the specified operating system user.
The Create Authorization dialog is divided into the following tabs:
Tab Description
Set Authorization Creates the association between a database user and an operating
system server user identification.
Display Authorization Displays database authorization details.

Display Authorization Tab


The Display Authorization tab contains the following fields:
Field Description
Authorization Name Displays all existing Authorization names.
Database Displays the existing database names that contain Authorization
definitions.
Display Displays the Authorization details for the selected criteria.
Select All Selects all items in the list.
Copy Copies all selected items to clipboard.
Logging Rules Displays logging rules.
Authorization Details Displays the authorizations details for the selected criteria.

Set Authorization Tab


The Set Authorization tab contains the following fields:
Field Description
Database Name Name of the database or user for this authorization.
Authorization Name Name of the authorization. It cannot be the same as a table, view, or macro
name.
Definer Keyword associates an operating system user to the Teradata Database that
contains an external routine. If Definer is specified, then the Database
Name must be the containing database for the external routine.

110 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Field Description
Invoker Keyword associates an operating system user to the database user who
invokes an external routine. If Invoker is specified, then the Database
Name must be a Teradata user. Only one Invoker authorization name can
be assigned per database.
Default [Optional] Keyword modifier for the DEFINER keyword associates the
authorization with all external routines that do not specify the
authorization name in the EXTERNAL SECURITY DEFINER clause of
the following statements:
CREATE/REPLACE FUNCTION
CREATE/REPLACE FUNCTION (Table Form)
CREATE PROCEDURE (External Form)
Only one default DEFINER can be assigned per database. If a default
Definer already exists for the specified database, the CREATE
AUTHORIZATION request fails.
Domain Domain name for the user. This applies only to Teradata Databases running
on Windows.
User Name Name of an operating system user that is defined on every node of the
system. Must be a member of the tdatudf user group.
Password Password of this operating system user.
Note: Type the complete password. Do not use the Paste command. Do not
use the arrow keys or the mouse to navigate in this field.

Comment [Optional] A comment to describe this Authorization object.

Grant, Revoke, or Display System Rights

The Grant, Revoke, or Display System Rights dialog enables you to grant, revoke, and
display system rights privileges on database users, roles, or user PUBLIC. It has two primary
tabs:
Grant/Revoke
SQL Preview

Grant/Revoke Tab
The tab contains the following elements and tabs:
Elements Description
To Objects Users(s) - Displays the database users list.
Roles(s) - Displays the database roles list.
Public - Displays only the PUBLIC user.
View Details Updates the Grant/Revoke/Display tabs with the system right
details based on selection of database objects.
Filter Privilege Filters the view to show only those system rights in grant/
revoke/display tabs selected from the filter privilege combo box.

Teradata Studio User Guide, Release 15.10 111


Chapter 5 Administration of Teradata Databases

Elements Description
Grant Grants system rights to database objects.
Revoke Revokes system rights from database objects
Display Displays the current system rights for the selected database
objects.

SQL Preview Tab


Use the SQL Preview tab to preview the SQL to submit before you click either the Grant or
Revoke button. The generated SQL is updated whenever privilege items are moved to either
To be granted or To be revoked. You can save the SQL into a project by using the Save SQL
option in the SQL Preview tab.

Display Tab
This tab contains the following fields:
Field Description
Details Displays the current privileges for the selected database object.

Grant Tab
The Grant tab displays the current grantable privileges on selected objects. To set system
rights, you move single or multiple privilege type(s) from the Grantable Privileges list to the
To be granted privileges list, and then click Grant.
1 In Grantable Privileges, review and then select the privileges to grant on objects you
selected in the To 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 using the following options:

Option Description
> Moves a single privilege from Grantable Privileges to To be granted.
< Moves a single privilege from To be granted to Grantable Privileges.
>> Moves multiple privileges from Grantable Privileges to To be granted.
<< Moves multiple privileges from To be granted to Grantable Privileges.

3 [Optional] Under Options select these options:

Option Description
With Grant Grants the WITH GRANT permission on the objects in the To be granted list.
All Children Grants the privileges to the children of the selected parent objects.

4 Preview the generated SQL statement in the SQL Preview tab and if necessary, repeat
previous steps to modify SQL.

112 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

5 Click Grant to submit SQL and grant privileges on the objects listed in the To be
granted list.

Revoke Tab
The Revoke tab shows the list of available revocable privileges for the selected objects and
lets you specify which privileges to revoke from that object. You must click Revoke to revoke
the privileges on the objects you select.
Move privileges from the Revocable Privileges list to the To be Revoked list to indicate
which privileges are to be revoked for the selected object.
1 In Revocable Privileges, review and then select the privileges to revoke on objects you
selected in the To Objects section of the dialog.
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 by using the directional arrows:

Option Description
> Moves a single privilege from Grantable Privileges to To be granted.
< Moves a single privilege from To be granted to Grantable Privileges.
>> Moves multiple privileges from Grantable Privileges to To be granted.
<< Moves multiple privileges from To be granted to Grantable Privileges.

3 [Optional] Under Options select these options:

Option Description
With Grant Revokes the WITH GRANT privilege on objects in the To be revoked list. If
selected the WITH GRANT OPTION is added to the REVOKE request in the
generated SQL statement. If this option is chosen, only the GRANT capability is
removed, not the privilege.
All Children Revokes privileges for the children of the selected parent objects. If selected, the
ALL option is added to the REVOKE request in the generated SQL statement.

4 Click Revoke to revoke privileges on objects listed in the To be revoked list.

SQL Preview Tab


The SQL Preview tab displays the generated SQL DDL statements required to grant or
revoke user system rights. 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 DDL statements and verify that the
definition is accurate.
2 Click the Grant/Revoke tab to change the user system rights defined in the SQL
statement.
Any changes you make automatically generate new SQL for your review.

Teradata Studio User Guide, Release 15.10 113


Chapter 5 Administration of Teradata Databases

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 Check one of the following:

Option Description
Run SQL Executes the SQL when you click Finish.
Save SQL Saves the SQL statement to an SQL file that you choose by typing the file path or
clicking Select. The Save SQL dialog opens. Select a project folder and type a file
name, then click OK and click Finish.

Display, Grant, and Revoke Privileges

The Display, Grant, or Revoke Privileges dialog enables you to display, grant, and revoke
privileges associated with database objects that are displayed in the Data Source Explorer.
You invoke the dialog by right-clicking a node in the Data Source Explorer and selecting
Teradata > Grant/Revoke > Privileges. Valid node objects are: databases, tables, views,
indexes, procedures, functions, and macros.

Grant/Revoke Tab
Element Description
Database The database containing the objects for which you want to grant or revoke
privileges.

114 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Element Description
Object Type Selects a specific object in the database. Select a data type to filter from the
list, and then select the object from the filtered list of objects. The object you
select becomes the target of the GRANT or REVOKE privileges action you
perform.
To Object Filters the selection list on the following options:
Users - Filters the list to contain only users.
Roles - Filters the list to contain only roles.
Public - Filters the list to contain only the PUBLIC user (also contained in
the Users list).
You can then select an object from the filtered list.
Grant/Revoke Filter Type of privilege on which to filter.
Privilege

The Grant/Revoke tab contains these additional tabs:


Tab Description
Grant Grants privileges to the user or role on the selected database object.
Revoke Revokes privileges from the user or role on the selected database
object.
Display Displays the privilege information for the selected database object.

SQL Review Tab


The SQL Preview tab displays the generated SQL DDL statements required to grant or
revoke privileges. The text in the Generated SQL region of the tab is red if the definition is
incomplete or contains an error. You can save or edit the text in the Generated SQL text
area.

Display Tab
The Display tab displays the privileges that the selected user or role is granted for the
database objects selected.
Column name Description
Privilege Contains the name of the privilege.
Grantable Contains a check mark if the user can grant the privilege.
Grantor Contains the name of the user who granted the privilege to this user.
Public Contains a check mark if the user is granted the privilege through the
PUBLIC user.

The display of role privileges uses only one column for the sort. You can change the sort
order of all columns by left-clicking the header of the column on which you want to sort.
Note: It is possible for a privilege to be displayed twice if the user has been granted the
privilege through a non-PUBLIC user and the PUBLIC user.

Teradata Studio User Guide, Release 15.10 115


Chapter 5 Administration of Teradata Databases

Grant Tab
The Grant tab enables you to grant privileges to the selected user or role on the database
object. The Grantable Privileges list displays only the privileges that the logged-on user can
grant. If the user has the privilege but not GRANT rights, the privilege is still displayed in this
list so that the WITH GRANT OPTION option can be applied.
The Grant tab contains the following elements:
Element Description
Grantable Privileges Lists the privileges that can be granted.
To be Granted Lists the privileges that are to be granted.
Options Select check boxes to add options to the SQL GRANT request.
With Grant - If selected, the WITH GRANT OPTION clause is added
to the GRANT request.
All Children - If selected, the ALL clause is added to the GRANT
request.
Grant Grants the privileges listed in the To be Grated list.

Include clause options in the GRANT request by selecting these options:


Option Description
ALL Adds the ALL clause to the GRANT request. The ALL clause specifies that the
specified user or database is to receive all privileges that can be granted on the
specified object. Only those object privileges owned by the grantor WITH
GRANT OPTION are granted.
ALL BUT Adds the ALL BUT clause to the GRANT request. The ALL BUT clause specifies
that the specified user is to receive all privileges that can be granted on the
specified object except for those specified in the privilege list. Only those object
privileges owned by the grantor WITH GRANT OPTION are granted.

Revoke Tab
The Revoke tab enables you to revoke privileges on the selected object for the selected users,
roles, or PUBLIC user rights. The Revokable Privileges list displays only the privileges that
the log-on user can revoke.
The Revoke tab contains the following elements:
Element Description
Revokable Privileges Allows the user who is logged on to revoke.
To be Revoked Privileges that you have selected to be revoked.
Options Filters the list by privilege type. For example, to select all ACCESS
privileges, select the ACCESS check box. The exact privileges selected
depend on the database object type.

116 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Element Description
With Grant - [Optional] If selected, the WITH GRANT OPTION is
added to the REVOKE request in the generated SQL statement. If this
option is chosen, only the GRANT capability is removed, not the
privilege.
All Children - [Optional] If selected, the ALL option is added to the
REVOKE request in the generated SQL statement.
Revoke Revokes the privileges listed in the To be Revoked list.

Include clause options in the REVOKE request by selecting these options:


Option Description
ALL Adds the ALL clause to the REVOKE request. The ALL clause specifies to revoke
from the specified user all privileges that can be granted on the specified object,
and that are held, either implicitly or explicitly, WITH GRANT OPTION by the
user executing the REVOKE.
ALL BUT Adds the ALL BUT clause to the REVOKE request. The ALL BUT clause
specifies to revoke all privileges except for those specified in the privilege list,
that can be granted on the specified object, and that are held, either implicitly or
explicitly, WITH GRANT OPTION by the user performing the REVOKE
request.

Grant, Revoke, or Display Column Rights

The Grant, Revoke, or Display Column Rights dialog enables you to grant, revoke, and
display table and view column rights privileges for database users, roles, or user PUBLIC.
The dialog contains two tabs:
Tabs Description
Grant/Revoke Selects database, table or view columns, and objects for which to set column
rights.
SQL Preview Reviews generated SQL and select to save or edit.

Grant/Revoke Tab
Main Option Sub Option Description
On Columns Database Name Selects the database name to retrieve table or view object
names.
Table Selects to display the table list for the selected database
name.
View Selects to display view list for the selected database name
All Columns Selects all column names to set column rights privileges.
Next select either database User(s), Role(s) or Public and
click the View Details button to update the Grant/
Revoke/Display tabs.

Teradata Studio User Guide, Release 15.10 117


Chapter 5 Administration of Teradata Databases

Main Option Sub Option Description


Specific Columns Selects single or multiple column names on which
column rights privileges need to be set. After selecting the
column names, select either database User(s), Role(s) or
Public and click the View Details button to update the
Grant/Revoke/Display tabs.
To Objects Users(s) Select to display the database users list.
Roles(s) Select to display the database roles list.
Public Select to display only the PUBLIC user.
View Details Click to update the Grant/Revoke/Display tabs with the
column rights details based on selection of database
objects.
Filter Privilege View only those column rights in grant/revoke/display
tabs which are selected from the filter privilege combo
box.
Grant Tab Grant column rights to database objects.
Revoke Tab Revoke column rights from database objects.
Display Tab Display the current column rights for the selected
database objects.

SQL Preview
The SQL Preview tab previews the generated SQL that is 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 SQL statements to a project by using the Save SQL option
in the SQL Preview tab.

Display Tab
The Display tab shows a detailed grid of the current privileges for the selected database
object. Object details display only after you click View Details.

Grant Tab
The Grant tab shows the list of grantable privileges for the selected objects and lets you
specify which privileges to grant. You must click Grant to grant the privileges on the column
name objects you select. The Grant tab contains two lists:
List Type Description
Grantable Privileges Lists current grantable privileges on the selected column name object.
To be granted Lists the privileges you select to be granted.

You move privileges from the Grantable Privileges list to the To be granted list to indicate
which privileges to grant on the selected column name objects.
1 In Grantable Privileges, review and then select the privileges to grant on objects you
selected in the To Objects section of the dialog.
Use the Shift and Ctrl keys to select multiple privileges.

118 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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 these options:

Option Description
With Grant Grants the WITH GRANT permission on the column name objects in the To be
granted list.
All Children Grants the privileges to the children of the selected parent objects.

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 column name objects listed in the
To be granted list.

Revoke Tab
The Revoke tab shows the list of available revocable privileges for the selected object(s) and
lets you specify which privileges to revoke from that object. You must click Revoke to revoke
the privileges on the column name objects you select. The Revoke tab contains two lists:
List Type Description
Revocable Privileges Lists current revocable privileges on the selected column name object.
To be revoked Lists the privileges you selected to be revoked for column name objects.

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 column name object.
1 In Revocable Privileges, review and then select the privileges to revoke on objects you
selected in the To Objects section of the dialog.
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 [Optional] Under Options select these options:

Option Description
With Grant Revokes the WITH GRANT privilege on the column name objects in the To be
revoked list. If selected, the WITH GRANT OPTION is added to the REVOKE
request in the generated SQL statement. If this option is chosen, only the GRANT
capability is removed, not the privilege.
All Children Revokes privileges for the children of the selected parent objects. If selected, the
ALL option is added to the REVOKE request in the generated SQL statement.

4 Click Revoke to revoke privileges on the column name objects listed in the To be
revoked list.

Teradata Studio User Guide, Release 15.10 119


Chapter 5 Administration of Teradata Databases

SQL Preview Tab


The SQL Preview tab displays the generated SQL GRANT and REVOKE statements required to
create grant and revoke privileges on column name objects. 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 Select 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 Column Rights dialog is
not closed.

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.
Tab Description
Grant/Revoke Select the trusted database users for which to set connect through rights.
SQL Preview Review generated SQL and select to save or edit.

Grant/Revoke Tab
Tabs Description
Trusted User Select the database user that you want proxy users to connect through.
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.

120 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Tabs Description
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 the Trusted User
field. 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.

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.

Teradata Studio User Guide, Release 15.10 121


Chapter 5 Administration of Teradata Databases

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.

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.

122 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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.
The dialog contains two tabs:
Tabs Description
Grant/Revoke Selects database users for which to grant or revoke log-on rights.
SQL Preview Reviews generated SQL and select to save or edit.

Grant/Revoke Tab
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.

Teradata Studio User Guide, Release 15.10 123


Chapter 5 Administration of Teradata Databases

SQL Review 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.

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.

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.

124 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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.

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.

Move Space

The Move Space dialog 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.
Space To Move Shows the amount of space to move between the selected databases. The
number is in terms of the selected KB, MB, or GB button. You can change
the value in the Space to Move field by typing the value, clicking the up/
down arrows to the right of the value, or by adjusting the Portion of space to
move slider (see below).
KB, MB, GB Indicates whether the units of space are kilobytes (KB), megabytes (MB) or
gigabytes (GB).
Portion of space to Provides an alternate way to specify the amount of space to move. The
move 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 Space to Move
field.
Allocations Shows two bars that indicate the allocation of used and free space of the
(graphical) databases selected in From Database and To Database. From left to right,
the bars indicate the amount of space in the From Database that is currently
in use, the amount that is free, the amount of space in the To Database that
is free and how much is in use. The bar labeled "Original" shows the current
allocation of the space for the selected databases. The bar labeled "New"

Teradata Studio User Guide, Release 15.10 125


Chapter 5 Administration of Teradata Databases

Option Description
shows what the allocation of space is if you move the amount of space
specified in the Space to Move field. The "New" bar information is adjusted
as you specify values in the Space to Move field. The shades of the segments
of the bars correspond to the shades of the headings in the Allocations
(numeric) table below.
Allocations Displays a table that shows the allocation of used and free space of the
(numeric) selected databases. The values display in the units of the selected KB, MB, or
GB button. The row labeled "Original" shows the current allocation of the
space for the selected databases. The row labeled "New" shows what the
allocation of space is if you move the amount of space specified in the Space
to Move field.
Move Space Moves the space from the From Database to the To Database. This button is
enabled only when all the required dialog fields contain valid values.

The message area at the top of the dialog 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 needs to be done. When there is enough information specified to move
space, the message changes to an information icon, and the Move Space button is enabled.

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.

126 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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.
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.

Teradata Studio User Guide, Release 15.10 127


Chapter 5 Administration of Teradata Databases

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.
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).

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.

128 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Option Description
Modify Query Enabled when you select Specific User(s). Select the selected list items in
Logging 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.

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.

Teradata Studio User Guide, Release 15.10 129


Chapter 5 Administration of Teradata Databases

Option Description
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 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)
Elapsed (1/100) is the default.
CPU Time
CPU (Normalized)
I/O Count

130 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Teradata Database Administration

Administer Roles

The Administer Roles dialog enables you to create or modify roles. You must have the
CREATE ROLE privilege to create a role.
1. In Role Name, type a new role name or select an existing role to modify from the list.
2. In Comment, type a brief description of the role.
3. If the role is an enterprise-wide role that is managed in a directory, select the External
Role check.
4. Click any of the Administrator Roles tabs and complete the information. This
information automatically generates an SQL DDL statement that you can preview and
run in the SQL Preview tab.

Administer Roles Tabs


The Administer Roles dialog is divided into the following four tabs:
Tab Description
User Members Assigns users to a new role or change the role membership for an
existing role.
User Member Attributes Specifies for each user member whether the role is the user's default
role and whether the user has administrator privileges.
Role Members Assigns additional roles to this role.
SQL Preview Views the SQL generated for the role attributes. Specify whether you
want to run the SQL to create or modify the role profile, save the
generated SQL to a file, or save the SQL DDL statements to the SQL
Editor for further editing.

About Roles
Roles define privileges on database objects. Using roles, a database administrator (DBA) can
define unique roles for different job functions and responsibilities. They can also define a
single role that they may assign to multiple users with identical database access
requirements. Typically, users are members of more than one role.
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.

About Role Types


There are two basic types of roles.

Teradata Studio User Guide, Release 15.10 131


Chapter 5 Administration of Teradata Databases

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. Use the
Privileges Dialog to grant privileges to a role.
Task Required Privilege
To modify a user's default CREATE USER or DROP USER
role
To grant a role to a user WITH ADMIN OPTION privilege on the role
or 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.

User Member Attributes Tab


The User Member Attributes tab enables you to specify the user's default role and to grant
administrative privileges to the role for a user.
Note: Before you add role attributes, you must create at least one user as a member of the role
using the User Members tab. To modify a user default role, you must have the CREATE
USER or DROP USER privilege.
1 For each user listed in the User Member column:
Select Set as Default Role to specify that this role is the user's default role.
Select With Admin to grant administrative privileges to this role for the user.
2 Click the SQL Preview tab to review the generated SQL statements.

User Members Tab


The User Members tab enables you to assign users to a role. You must have the WITH
ADMIN OPTION privilege to grant a role to a user. The User Members tab contains two
lists:
List name Description
All Users Lists all users in the database.

132 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

List name Description


User Members Lists users in the database who are assigned to the role. If you are creating
a new role, this list is empty.

1 From the All Users list, select the users to assign to the role and move them to the User
Members list using the directional arrows.
The single arrow moves a single user; the double arrow moves multiple users.
2 Click the SQL Preview tab to view the generated SQL DDL statement.

Role Members Tab


The Role Members tab enables you to select roles to be added as members to this role.
The tab is divided into two panels. The All Roles panel shows a list of all roles in the
database. The Role Members panel shows the current list of roles assigned to this role. If you
are creating a new role, the Role Members list is empty.
Note: You must have the WITH ADMIN OPTION privilege to grant a role to a role.
1 From the All Roles list, select the roles to assign to this role and move them to the Role
Members list using the directional arrows.
The single arrow moves a single role; the double arrow moves multiple roles.
2 Click the SQL Preview tab to view the generated SQL DDL statement.
When you add a role to a role, an SQL GRANT statement is generated in the SQL
Preview tab. The SQL GRANT statement grants the role the role. When you remove a
role from the Role Members list, an SQL REVOKE statement is generated which revokes
the role from this role when you run the SQL.
Note: Roles can only be nested one level deep. A role that has a nested role as a member
cannot also be a nested role.

SQL Preview Tab


The SQL Preview tab displays the generated SQL CREATE ROLE statement required to
create roles and grant users and roles to the role. 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 CREATE ROLE statement and verify that
the definition is accurate.
2 [Optional] Click the Administer Roles tab to modify the role attributes in the SQL
statement.
The changed information is automatically generated in the SQL that displays.
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 Click one of the following:

Teradata Studio User Guide, Release 15.10 133


Chapter 5 Administration of Teradata Databases

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.
Run SQL Executes the SQL. This actions resets the Administer Roles dialog.
Show in Editor Displays the SQL statement in the SQL Editor. To edit the SQL, you
must close the Administer Roles dialog.

Aster Database Administration

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
rights to use it unless you grant them the privilege to use it. As the owner, only you have the
right 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 Grant users at minimum the CREATE privilege
database 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 right to create tables or objects in Revoke the CREATE rights on a database or
a database schema for the user.

Changing Privileges on Aster Databases


The Aster databases created for each Aster Database server are shown in the Object Viewer
when you select the connection profile for the server in Data Source Explorer. You must
own the database object that you want to modify or be granted privileges that allow you to
modify its privileges.
1 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.

134 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

2 Open Data Source Explorer.


3 Click the name of the Aster Database connection profile associated with the database on
which you want to modify privileges.
The Object Viewer displays the Aster Database server name above the Databases,
Users, and Roles tabs.
4 Click the Databases tab.
5 In the Database Name column, click the database on which you want to modify
privileges.
The Database object form displays below the Object Viewer view.
6 In the Database object form, select a property tab in the left pane to view database
properties and privileges you might want to edit.
a [Optional] Click General to view the Name assigned to the database and the
Encoding selected. You cannot edit these fields.
b [Optional] Click Privileges and select the Grantee Type for which you want to view
privileges.
c Grant or revoke privileges by double-clicking a privilege icon to toggle to the opposite
privilege; for example, from granted to revoked, revoked to granted, not-granted to
granted, and so forth.
Use the legend above the table to make sure you've set the privilege correctly.

Grantee Type Privilege Options


Users CREATE, CREATE w/Grant, CONNECT, CONNECT w/Grant
Roles CREATE, CREATE w/Grant, CONNECT, CONNECT w/Grant
PUBLIC CREATE, CONNECT

7 Click SQL and review the generated DDL statement that includes your changes.
8 Click Commit to execute the new definition for the database.

Changing Privileges on Schemas


The Object Viewer displays the Schema object form which enables you to change privileges
assigned to an Aster schema object. After you change a privilege, be sure to review the
generated DDL statement and click Commit to execute it. The Aster schema object
definition is not changed on the Aster Database server until you commit.
Tip: Double-clicking a Privileges selection box toggles to the opposite privilege; for example,
from granted to revoked or revoked to granted.
1 Open Data Source Explorer and select the Aster database schema on which you want to
modify privileges.
2 Right-click the schema and select Aster > Grant/Revoke Privileges.
The Schema object form displays below the Object Viewer view.

Teradata Studio User Guide, Release 15.10 135


Chapter 5 Administration of Teradata Databases

3 In the Schema object form, click Privileges in the left panel.

4 In Grantee Type, select one of the following from the list:


Users
Roles
PUBLIC
a With Grantee Type selected as Users select the user for whom you want to modify
rights to this schema.
b Double-click the selection boxes to the right of the selected user's name to change the
CREATE, CREATE w/Grant, USAGE, USAGE w/Grant, INSTALL FILE, or CREATE
FUNCTION privileges.
Note: The db_superuser is by default given the INSTALL FILE and CREATE
FUNCTION roles for this schema.
c With Grantee Type selected as Roles select the role on which you want to modify
rights to this schema.
d Double-click the selection boxes to the right of the selected role's name to change the
CREATE, CREATE w/Grant, USAGE, USAGE w/Grant, INSTALL FILE, or CREATE
FUNCTION privileges.
e With Grantee Type selected as PUBLIC click public to modify the public role on this
schema.
f Double-click the selection boxes to the right of public to modify the CREATE,
USAGE, INSTALL FILE, and/or CREATE FUNCTION privileges.
Note: Any new privileges you might grant are shown as Grants. After you click
COMMIT and return to the Privileges tab, privileges change to Granted.
5 Click SQL to review the generated DDL. with added GRANT and/or REVOKE
statements.
6 Click Commit to set the privileges you modified for this schema.

Changing Privileges on Aster Views


You can change privileges on an Aster view object using the View object form. The Object
Viewer displays this form when you select the Grant/Revoke Privilege option for a view
displayed in the Data Source Explorer. After you change a privilege, be sure to review the
generated DDL statement and click Commit to execute it. The Aster view object definition is
not changed on the Aster Database server until you commit.
Tip: Double-clicking a Privileges selection box toggles to the opposite privilege; for example,
from granted to revoked or revoked to granted.
1 Open Data Source Explorer and select the Aster view object on which you want to
modify privileges.
2 Right-click the schema and select Aster > Grant/Revoke Privileges.
The View object form displays below the Object Viewer view.

136 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

3 In the View object form, click Privileges in the left panel.

4 In Grantee Type, select one of the following from the list:


Users
Roles
PUBLIC
a With Grantee Type selected as Users select the user for whom you want to modify
rights to this view.
b Double-click the selection boxes to the right of the selected user's name to change the
SELECT and/or SELECT w/Grant privileges.
c With Grantee Type selected as Roles select the role on which you want to modify
rights to this view.
d Double-click the selection boxes to the right of the selected role's name to change the
SELECT and/or SELECT w/Grant privileges.
e With Grantee Type selected as PUBLIC click public to modify the public role on this
schema.
f Double-click the selection box to the right of public to change the SELECT privilege.
Note: Any new privileges you might grant are shown as "Grants". After you click
COMMIT and return to the Privileges tab, privileges change to "Granted".
5 Click SQL to review the generated DDL. with added GRANT and/or REVOKE
statements.
6 Click Commit to set the privileges you modified for this view.

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.
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.
Object Viewer provides a Privileges tab for each Aster database object, role, and user where
you can grant privileges and membership in roles that define rights to objects.

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.

Teradata Studio User Guide, Release 15.10 137


Chapter 5 Administration of Teradata Databases

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.

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.

138 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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.
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.
Action Bar
The action bar in the upper right corner allows you to execute SQL to create the user
definition. You can also reset the User form and begin again, or cancel and close the
form. You must execute the generated SQL by clicking Commit to create the user
object before you can assign roles or privileges.

Creating an Aster Database User

1 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 In Data Source Explorer, click the Aster connection profile name for the Aster Database
in which you want to create a user.
The Object Viewer opens and displays the Users associated with the profile.
3 In the Object Viewer toolbar, click (Create a new Aster user).
4 Navigate to the Users object form which displays below the list of Users in the Object
Viewer main view.
5 Click General and type a name for the user.

a Type a Name for the new user.

b Type the user Password.

Teradata Studio User Guide, Release 15.10 139


Chapter 5 Administration of Teradata Databases

c In Confirm Password, retype the password you entered in the previous step.

d Select the Inherit check box to enable this user to automatically inherit group
privileges.
6 Review the generated SQL and click Commit to create the user.
After you create the user, you can continue to specify additional properties such as roles
for the user and object privileges.
7 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.

8 Click Object Privileges.

a Select the Object Type from the list.


The options are Database, Schema, Table, View, and Function.
b Select the Database that contains the objects on which you want to set privileges for
the user. You also can select to display objects in ALL databases.
c Set the privilege for each object you select in the Object Name column.
The legend above the table helps you to select the correct privilege.

Object Name Description


Granted Privilege granted to object.
Not Granted Privilege not granted to object.
Granted but not Revocable Privilege granted and cannot be revoked.
Not Grantable Privilege cannot be granted to the object.
Grants Object selected to have privilege granted.
Revokes Object selected to have privilege revoked.

9 Click SQL.

a Review the DDL statement generated.

b Modify the CREATE statement by returning to previous steps to change your


selections.
10 Click Commit to execute the DDL statement and create the database user.

140 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

Changing Privileges and Roles for an Aster User


You can view Users created in an Aster Database by selecting the connection profile
associated with the database in Data Source Explorer. A list of Users displays in Object
Viewer. You must own the User object that you want to modify or be granted privileges to
modify it.
1 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 Open Data Source Explorer.
3 Click the name of the Aster Database connection profile associated with the database
users for which you want to modify.
The Object Viewer displays the Aster Database server name above the Databases,
Users, and Roles tabs.
4 Click the Users tab.
5 In the User Name column, click the user for which you want to modify privileges and
roles.
The User object form displays below the list of Users in the Object Viewer main view.
6 In the User object form, select a property tab in the left pane to view the user properties
you might want to change.
a [Optional] Click General to view the Name assigned to the user and the Inherit
status. You cannot edit these fields.
b [Optional] Click In Roles and double-click the IN ROLE and/or IN ROLE w/Admin
selection box to add or remove the user from the role.
c [Optional] Click Object Privileges and select the Object Type for which you want to
view privileges.
Note: Use the legend above the table to check that you set the privilege correctly and
to understand what each privilege icon means.
d [Optional] With Database selected as the Object Type, in the Object Name column
select the database you want to modify.
e [Optional] Double-click the privilege selection boxes to the right of the database
name to assign CREATE, CREATE w/Grant and/or CONNECT w/Grant privileges
for the database.
f [Optional] With Schema selected as the Object Type, use the Database list to select
the name of the Aster database which contains the schema for which you want to
modify object privileges.
g [Optional] Double-click the privilege selection boxes to the right of the schema name
to assign CREATE, CREATE w/Grant, USAGE, USAGE w/Grant, INSTALL FILE,
and/or CREATE FUNCTION privileges for the schema.

Teradata Studio User Guide, Release 15.10 141


Chapter 5 Administration of Teradata Databases

h [Optional] With Table selected as the Object Type, select first the name of the Aster
Database and next the Schema which contains the object for which you want to
modify object privileges.
i [Optional] Double-click the privilege selection boxes to the right of the Table object
name to assign SELECT, SELECT w/Grant, UPDATE, UPDATE w/Grant, DELETE,
and/or DELETE w/Grant privileges for the object.
j [Optional] With View selected as the Object Type, select first the name of the Aster
Database and next the Schema which contains the View object for which you want to
modify object privileges.
k [Optional] Double-click the privilege selection boxes to the right of the View object
name to assign SELECT, or SELECT w/Grant privileges for the object.
l [Optional] With Function selected as the Object Type, select first the name of the
Aster Database and then the Schema which contains the Map Reduce Function
object you want to modify.
m [Optional] Double-click the privilege selection boxes to the right of the Function
object name to assign the EXECUTE privilege for the object.
7 Click SQL and review the generated DDL statement that executes your changes on the
User object definition.
8 Click Commit to execute the DDL for the User object.

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.
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.

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.

142 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

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.
Action Bar
The action bar in the upper right corner allows you to execute the SQL to create the
role, reset the form, or cancel and close the form. Be sure to commit your DDL role
definition to create a new role or to save your changes to an existing role in the Aster
Database.

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 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 Open Data Source Explorer.
3 Select the Aster Database connection profile for the database in which you want to create
a role.
4 In the Object Viewer toolbar, click (Create a new Aster role).

Teradata Studio User Guide, Release 15.10 143


Chapter 5 Administration of Teradata Databases

5 Navigate to the Roles object form which displays below the list of Roles in the Object
Viewer main pane.
6 Click General.

a Type a Name for the new role.

b Select the Inherit check box to specify this role inherits the privileges of roles of which
it is a member.
c Select the Role can create database check box to give the role the rights to create a
database object.
d Select the Role can create role check box to give the role rights to create a role.
7 Review the generated SQL and click Commit to create the role.
After you create the role, you can continue to specify role properties such as role
membership and rights to specific database objects.
8 Click In Roles and specify to which roles the new role will be added as a new member
with IN ROLE or IN ROLE w/Admin privileges.

Roles Description
In Role Role is a member in the role.
Not in Role Role is not a member in the role.
Add to Role Role selected to be added as a member to the role.
Remove from Role Role selected to be removed as a member of the role.

9 Click Members of Role and select the Member Type.


The options are User or Role.
10 For each user or role to be added as a member of this role, specify the MEMBER and/or
MEMBER w/Admin privileges.
Members of a role can use the privileges of the group role.

Role/User Name Description


Member of Role Role or User granted membership in the role.
Not Member of Role Role or User is not granted membership in the role.
Add as Member Role or User selected to be added as a member to this role.
Remove as Member Role or User selected to be removed as a member of this role.

11 Click Object Privileges.

a Select the Object Type from the list.


The options are Database, Schema, Table, View, and Function.
b Select the Database that contains the objects on which you want to set privileges. You
also can select to display objects in ALL databases.

144 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

c Set the CREATE, CREATE w/Grant, CONNECT, and/or CONNECT w/Grant


privilege for each object you select in the Object Name column.
The legend above the table helps you to select the correct privilege.

Object Name Description


Granted Privilege granted to object.
Not Granted Privilege not granted to object.
Granted but not Revocable Privilege granted and cannot be revoked.
Not Grantable Privilege cannot be granted to the object.
Grants Object selected to have privilege granted.
Revokes Object selected to have privilege revoked.

12 Click SQL.

a Review the DDL statement generated.

b Modify the CREATE statement by returning to previous steps to change your


selections or manually change the text of the DDL statement in the editor.
13 Click Commit to execute the DDL statement and create the database role.

Changing Privileges and Roles on Aster Roles

1 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 In Data Source Explorer, select the Aster connection profile in which you want to
change privileges on roles.
The Object Viewer opens.
3 Click the Roles tab.
4 Select the role on which you want to change privileges and/or role membership.
The Role object form opens and displays the name of the role you selected.
5 [Optional] Click In Roles and specify the IN ROLE or IN ROLE w/Admin privileges for
the selected role.

Roles Description
In Role Role is a member in the role.
Not in Role Role is not a member in the role.
Add to Role Role selected to be added as a member to the role.
Remove from Role Role selected to be removed as a member of the role.

6 [Optional] Click Members of Role and select the Member Type.


The options are User or Role.

Teradata Studio User Guide, Release 15.10 145


Chapter 5 Administration of Teradata Databases

7 For each user or role to be added as a member of this role, specify the MEMBER and/or
MEMBER w/Admin privileges.
Members of a role can use the privileges of the group role.

Role/User Name Description


Member of Role Role or User granted membership in the role.
Not Member of Role Role or User is not granted membership in the role.
Add as Member Role or User selected to be added as a member to this role.
Remove as Member Role or User selected to be removed as a member of this role.

8 [Optional] Click Object Privileges.

a Select the Object Type from the list.


The options are Database, Schema, Table, View, and Function.
b Select the Database that contains the objects on which you want to set privileges. You
also can select to display objects in ALL databases.
c Set the CREATE, CREATE w/Grant, CONNECT, and/or CONNECT w/Grant
privilege for each object you select in the Object Name column.
The legend above the table helps you to select the correct privilege.

Object Name Description


Granted Privilege granted to object.
Not Granted Privilege not granted to object.
Granted but not Revocable Privilege granted and cannot be revoked.
Not Grantable Privilege cannot be granted to the object.
Grants Object selected to have privilege granted.
Revokes Object selected to have privilege revoked.

9 Click SQL.

a Review the DDL statement generated.

b Modify the GRANT statement by returning to previous steps to change your


selections or manually change the text of the DDL statement in the editor.
10 Click Commit to execute the DDL statement and modify the privileges and role
membership for this role.

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.

146 Teradata Studio User Guide, Release 15.10


Chapter 5 Administration of Teradata Databases

1 In Data Source Explorer, click the Aster Database connection profile that contains the
role you want to drop.
The Object Viewer displays the Databases, Users, and Roles for the selected Aster
Database.
2 Click the Roles tab and in the Role Name column select the role you want to drop.
You can select multiple roles to drop at one time.
3 In the Object Viewer toolbar, click (Drop the selected object).
4 When prompted to confirm the drop, click OK.

Teradata Studio User Guide, Release 15.10 147


Chapter 5 Administration of Teradata Databases

148 Teradata Studio User Guide, Release 15.10


CHAPTER 6

Development of Teradata Databases

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. It will then
expand and select that object in the Data Source Explorer. If the Object Viewer is open, the
object also displays in the Object Viewer window. Find Object uses the Teradata
Dependency Browser to perform the search for the specific object type.
Note: The search is not case sensitive.

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.

Teradata Studio User Guide, Release 15.10 149


Chapter 6 Development of Teradata Databases

Option Description
Reset Resets the Search Value to an empty field and the Object Type for
the selected location in the Data Source Explorer.

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
Connection Profiles available Folder, a list of databases for the given Connection Profile appears.
for the search If you opened the 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

150 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Option Description

Search Option Description


Index names. All other object
type name options are
disabled.
Enter a valid SQL search Use for a custom search
pattern 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 to: The limit to the size of the search result list. Valid values are
between 1 and 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

Teradata Studio User Guide, Release 15.10 151


Chapter 6 Development of Teradata Databases

Within each object type category, it is further grouped by sub-element, such as:
Columns
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.
You can also open an object for closer viewing in the Object Viewer. Double-clicking an
object opens the object in its own Object Viewer tab. This option is enabled on all entries in
the Find Result table, including columns, constraints, and parameters.

Data Definitions Generation

Generate DDL Basics

You can generate data definitions for a database and their objects using the Generate DDL
wizard available in the Teradata Administrator perspective. The generated SQL Data
Definition Language (DDL) scripts you create can then be executed to define the structure of
a database, including tables and triggers, functions, and views.
The DDL is generated and saved in an Eclipse project. You have the option to then execute
the DDL script directly on a specified connection profile from an SQL Editor. You can use
this .sql file to create the same database object in a different database, or you can generate the
DDL for a complete database to create a new database on a different server. You can also
open the .sql file in an SQL Editor instance and edit it to make changes.
The ability to generate DDL scripts for database objects and execute it from an SQL Editor is
supported for Teradata Database and Teradata Aster Database 6.10.

Generating DDL Dialog

Data definition language (DDL) defines the structure of a database, including rows, columns,
tables, indexes, and more. You can generate data definition language (DDL) for a database,
database objects, or both using the Generate DDL wizard. The DDL is generated into a .sql
file in an Eclipse project, or is executed directly on the specified Connection Profile. You can
use this .sql file to create the same database object in a different database, or you can generate
the DDL of a complete database to create a new database on a different server. You can edit
the .sql file if you want to make changes.
1 In the Data Source Explorer, right-click a database, table, user-defined function, user-
defined datatype, or a database view.

152 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

2 Select the model elements to include in the DDL script and click Next.

Option Description
DROP statements Generates SQL drop statements. DROP statements remove an existing
object from the database.
CREATE statements Generates SQL CREATE statements.
Comments Generates COMMENT statements.

3 Select the model objects to include in the DDL script and click Next.
The object type determines which model object options are available.

Option Description
Functions User-defined function
Hash/Join Indexes Database, table
Macros Database
Databases Database
Stored Procedures Stored procedure
Tables Database, table
Triggers Database, table
User-Defined Types User-defined datatype
Views database, view

4 Select Save and run DDL options, then click Next.

Option Description
Folder Name Project folder name. You can click Browse to select a folder.
File Name File name
Preview DDL Previews the generated DDL.
Open DDL File for Editing Opens SQL file in the SQL Editor.

5 Click Finish.

Displaying DDL Statements

1 Connect to a Teradata Database or Teradata Aster Database 6.10.

2 Open the Data Source Explorer and navigate to a database object.


3 Right-click the object name and do one of the following:
For Aster objects, select Aster > Display DDL.
For Teradata objects, select Teradata > Display DDL

Teradata Studio User Guide, Release 15.10 153


Chapter 6 Development of Teradata Databases

4 When a message displays and asks if you want to switch to the Query Development
perspective, click Yes.
The DDL text displays in an SQL Editor.

Generating DDL for Teradata Objects

The Generate DDL wizard enables you to generate the data definition for Teradata databases
and their objects. The Generate DDL feature is only available in the Teradata Administrator
perspective. You can execute the DDL script from the SQL Editor.
1 Open the Teradata Administrator perspective by clicking the Teradata Administrator
tab in the perspective bar.
2 In the Data Source Explorer, expand a Teradata database node.
3 Right-click a database, table, user-defined function (UDF), user-defined datatype (UDT),
or view object and select Teradata > Generate DDL....
The Objects dialog of the Generate DDL wizard opens.
4 Select which statements to include in the DDL script by selecting one or more of the
following check boxes:

Option Description
DROP statements Generates SQL DROP statement in a DDL script. DROP statements
remove a definition from the data dictionary.
CREATE Generates SQL CREATE statement in a DDL script. CREATE statements
statements create or replace a definition.
Comments Generates COMMENT statement in a DDL script. COMMENT statements
create a user-defined description of an object or definition in the data
dictionary.

5 [Optional] Click action buttons to quickly select which objects to include in the script.
Select All Selects DROP and CREATE statements and Comments.
Deselect All Selects no check boxes.
Restore Defaults Selects only CREATE statement and Comments as the defaults.
6 Click Next.
7 Select the object definitions to include in the DDL script.
The object definitions you are able to generate depend on the type of database object you
selected in Data Source Explorer.

Type Available Definitions


Database Databases, Hash/Join Indexes, Macros, Tables, Triggers, and Views
Stored Procedure Stored Procedures
Table Hash/Join Indexes, Tables, Triggers, and Views

154 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Type Available Definitions


User-Defined Type User-Defined Types
User-Defined Function User-Defined Functions
View Views

8 [Optional] Click action buttons to quickly select which objects to include in the script.
Select All Selects all the objects.
Deselect All Selects no objects.
Restore Defaults Selects all objects as the default.
9 Click Next.
Based on your selections, the wizard generates the DDL and displays the resulting script
in the Save DDL dialog.
10 In Folder, specify the path to the folder where you want the generated DDL script saved.
The default is the SQL folder displayed in the Project Explorer. Click Browse to specify
a different folder.
11 Type the File Name for the file in which the script is saved.
12 Review the generated DDL script in the Preview DDL section.
13 [Optional] Select the Open DDL file for Editing check box to open this SQL file in an
SQL Editor when you click Finish.
14 Click Next.
15 Review the Summary of selections you made in previous steps.
If you want to change a setting, click Back to return to a previous dialog and make your
change.
16 Click Finish.
17 [Optional] If you selected the Open DDL File for Editingoption, and you are not
working in the Query Development perspective, click Yes to switch to the Query
Development perspective.
The generated DDL script displays in a SQL Editor instance where you can edit it.

Generating DDL for Aster Objects

The Aster Generate DDL wizard enables you to generate the data definition for Aster
schemas and their objects. This feature requires Aster Database 6.10 or later.
1 Clicking Teradata Administrator in the perspective bar.
2 In the Data Source Explorer, expand an Aster database node.

3 Right-click an object and select Aster > Generate DDL....


The Objects dialog of the Aster Generate DDL wizard displays.

Teradata Studio User Guide, Release 15.10 155


Chapter 6 Development of Teradata Databases

4 Select one or more of the following boxes:

Option Description
DROP statements Generates SQL DROP statement in the DDL script. DROP statements
remove a definition from the data dictionary.
CREATE statements Generates SQL CREATE statement in a DDL script. CREATE statements
create or replace a definition.

5 [Optional] Click one of the following buttons:


Select All Selects DROP statements and CREATE statements.
Deselect All Selects no statements.
Restore Defaults Selects only CREATE statements.
6 Click Next.
7 Select object definitions to include in the DDL script.
The object definitions you are able to generate depend on the type of database object you
selected in Data Source Explorer.

Type Available Definitions


Schemas Map Reduce Functions, Schemas, Tables, and Views
Map Reduce Functions Map Reduce Functions
Table Tables
View Views

8 Click Next.
The resulting script displays in the Save DDL dialog.
9 In Folder, specify the path to the folder where you want the generated DDL script saved.
10 In File Name, type the name of the file in which to save the script.
11 Review the generated DDL script in the Preview DDL section.
12 [Optional] Select Open DDL file for Editing to open this SQL file in an SQL Editor.
13 Click Next.
The Summary of selections you made in previous steps displays.
14 Click Finish.
15 [Optional] If you selected the Open DDL File for Editing option, and you are not
working in the Query Development perspective, click Yes to switch to the Query
Development perspective.
The generated DDL script displays in a SQL Editor instance where you can edit it.

156 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Teradata Database Development

Create Database

The Create Database dialog enables you to define a new database and to run the generated
SQL DDL statement to create that database. You can also save the generated SQL to a file for
future editing or execution.
Element Description
Parent Database Name Parent database in which the new database is created.
New Database Name Name of the new database.
Definition Description of the new database.
SQL Preview Displays the generated SQL DDL statement for the new database
and execute the SQL to create it. You can also choose to save the SQL
to a file.
Reset Clears the dialog in preparation to define a new database.

Modify Database

The Modify Database dialog enables you to change the definition of an existing database,
including journal tables, and run the generated SQL DDL statements to modify the database
or save the generated SQL DDL to a file.
The dialog contains the following elements:
Element Description
Parent Database Name Displays the name of the owning database
Database Name Displays the name of the database you are modifying
Definition Displays the database definition information. You can
edit this information.
ModifyJournal Displays the journal table information. You can
modify this information.
SQL Preview Review the SQL generated for the new database you
have specified. You can run the SQL to create the
database or save the generated SQL to a file.
Reset Clears fields in preparation to define a new database.

Create User Wizard

The Create User wizard enables you to define a new Teradata user and either run the
generated SQL DDL statements to create the user object in the database or save the
generated DDL to a file.

Teradata Studio User Guide, Release 15.10 157


Chapter 6 Development of Teradata Databases

Options Description
User Definition information to describe the new user such as the
user name.
Database Definition information concerning database properties such
as permanent space size.
Session Definition information concerning the user session such as
the default character set.
Comment Comment string for this user definition.
SQL Review of the SQL DDL statements generated for the new
user you specified and run the SQL to create the user or save
the generated SQL to a file.
Reset Clear dialog fields before you define a new user.

Modify User

Use the Modify User dialog to change the attributes of a user definition.
The dialog contains the following tabs:
Tab Description
User Information Modifies information about the user such as the user's account.
Database Information Modifies information such as permanent space size.
Session Information Modifies information such as default character set.
Password Information Modifies the user password.
Comment Sets the comment for this user.
SQL Preview Reviews the SQL generated for the user you modified and run the
SQL to modify the user, save the generated SQL to a file, or save the
CREATE USER DDL statements to the SQL Editor.
Reset Clears the dialog fields back to original values.

Clone User

The Clone User dialog enables you to create a new user from an existing user definition. The
dialog populates the new user attributes with the user values of the existing definition. You
can then modify or accept the values as you choose. Attributes such as the user name and
password are required fields.
The Clone User dialog is divided into the following six tabs:
Tab Description
User Information Information about the user such as the user's account and default role.

158 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Tab Description
Database Database information such as permanent and temporary disk space
size.
Password User password.
Session Session information such as default date form and default character set.
Comment Comments.
SQL Preview Views the SQL generated for the cloned user definition. Specify whether
you want to run the SQL to create the user, save the generated SQL to a
file, or save the create user DDL statements to the SQL Editor.
Complete the information requested on each tab and then go to the SQL Preview tab to:
View the generated SQL for the CREATE USER statement
Show the CREATE USER statement in an Editor for editing
Run the SQL to create a new user
Save the SQL in a file
You can click Reset at any time to return all fields to their original values.

Create Table

The Create Table dialog enables you to create database tables and run generated SQL DDL
statements to create the table. Also, you can save the generated SQL to a file for future
editing or execution.
Option Description
Database Name Database in which to create the table.
Table Name Name of the table.
Temporary Table Sets the table to be temporary. If you do not select the box, the table
continues to be persistent.
Columns Defines the columns that make up the table.
Primary Key Specifies the Primary Key of the table.
Indexes Specifies the indexes of the table.
Foreign Keys Specifies Foreign Key references to other tables.
Summary Displays a summary of the columns in the table.
SQL Preview Views the SQL generated for the table and run the SQL to create the
table. Also you can save the generated SQL to a file.
Reset Clears the dialog fields in preparation to create a new table.

Create View

The Create View dialog defines views of database tables. You can execute the generated SQL
DDL statements to create the view or save the generated SQL to a file.

Teradata Studio User Guide, Release 15.10 159


Chapter 6 Development of Teradata Databases

Option Description
View Name Specifies the name of the view to create.
Table and Columns Selects the table on which the view is based and the
columns to include in the view.
Options Specifies additional options for the view.
SQL Preview Reviews the SQL generated for the view you specified
and run the SQL to create the view. You can also save
the generated SQL to a file.
Reset Clears the dialog fields before you define a new view.

Create/Modify View

The Create/Modify View dialog enables you to define views and execute the generated SQL
DDL to create the view or save it to a file.
Option Description
Database Name Specifies the database in which you want the view created.
When modifying an existing view, the database of the
current view is selected by default.
View Name Specifies the name of the view to create. When modifying
an existing view, by default the name is set to the name of
the view being modified.
View Name Indicates whether to define a RECURSIVE view.
Query SQL Specifies the query statement that determines the
contents of the view.
Options Specifies additional options for the view. You can specify
optional column names and locking clauses.
SQL Preview Displays SQL generated for the view and optionally
executes the SQL to create or update the view or saves the
generated SQL to a file.
Reset Returns settings to the original definition of the view
(when modifying an existing view) or clears the dialog
fields (when creating a new view).

Create Trigger

The Create Trigger dialog enables you to define the triggers of database tables. You can
specify the actions of the trigger and run the generated SQL DDL statement to create the
trigger. You can also choose to save the generated SQL to a file.
Options Description
Trigger Database Name Select the name of the database to hold the new trigger.

160 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Options Description
Trigger Name Specify the name of the trigger.
Trigger Specification Specify when the trigger is activated and how to refer to table values
before and/or after changes occur.
Action Statements Specify the statement to run when the trigger is activated and the
conditions that determine if the trigger is activated.
SQL Preview Review the SQL generated for the trigger. You can run the SQL
statement to create the trigger or save the generated SQL to a file.
Reset Click Reset to clear the dialog fields in preparation for defining a
new trigger.

Create Macro

The Create Macro dialog enables you to define database macros and run the generated SQL
DDL statements to create the macro. You can also save the generated SQL to a file.

Option Description
Database Name Lists available databases. Select the database in
which to create the macro.
Macro Name Specifies the name of the macro.
Parameters Defines the parameters that make up the macro.
Macro Body Specifies the AS Clause of the macro.
Parameter Summary Displays a summary of the parameters in the
macro.
SQL Preview Displays the SQL generated for the macro you
specified. You can review the SQL statement and
then run the SQL to create the macro or save the
generated SQL to a file.
Reset Clears the dialog fields before you define a new
macro.

Create Stored Procedure

The Create Stored Procedure dialog enables you to define SQL stored procedures and run
the generated SQL statements to create the stored procedure, or save it to an SQL file to
modify and run later. It does not support creating External Stored Procedures.

Option Description
Database Name Specifies the database in which to create the
stored procedure.

Teradata Studio User Guide, Release 15.10 161


Chapter 6 Development of Teradata Databases

Option Description
Stored Procedure Name Specifies the name of the stored procedure to
create.
Dynamic Result Sets Specifies the number of dynamic result sets
returned by the Stored Procedure (*Teradata 12.0
and higher feature).
Parameters Defines the IN, OUT, and INOUT parameters
that make up the stored procedure.
Stored Procedure Body Specifies the body of the stored procedure.
Parameter Summary Displays a summary of the parameters in the
stored procedure.
SQL Preview Displays the SQL that is generated for the stored
procedure you specified. You can execute the
SQL statements to create the stored procedure or
save to an SQL file.
Reset Clears the dialog before you define a new stored
procedure.

Create User-Defined Function

The Create User-Defined Function dialog enables you to define database user-defined
functions (UDF). You can then run the generated SQL DDL statements to create the user-
defined function or save the generated SQL to a file to possibly modify and run later.
Option Description
Database Name Specifies the database in which to create the user-
defined function.
User-Defined Function Name Specifies the name of the user-defined function to
create.
Parameters Defines the parameters that make up the user-defined
function.
Return Type Defines the return type for the user-defined function.
User-Defined Function Body Specifies the AS Clause of the user-defined function.
Parameter Summary Displays a summary of the parameters in the user-
defined function.
SQL Preview Displays the SQL generated for the user-defined
function you specified and then runs the SQL to create
the user-defined function or saves the generated SQL to
a file.
Reset Clears dialog fields before you define a new user-
defined function.

162 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Create Structured User-Defined Type

The Create Structured User-Defined Type dialog defines the database user-defined type
and runs the generated SQL DDL statements to create the user-defined type. You can also
save the generated SQL DDL to a file to modify and run later.
Element Description
Database Name Select the database in which to create the user-define type. In
this case, it is always SYSTUDTLIB.
Type Name Specify the name of the user-defined type to create.
Attributes Define the attributes that make up the user-defined type.
Edit Edit the user-defined type SQL DDL statement to create.
Attribute Summary Displays a summary of the attributes in the user-defined
type.
SQL Preview Review the SQL DDL statements generated for the user-
defined type you specified. You can execute the SQL to create
the user-defined type or save the generated SQL to a file.
Reset Click Reset to clear the dialog fields before you define a new
user-defined type.

Create Distinct User-Defined Type

The Create Distinct User-Defined Type dialog defines a database user-defined type and
runs the generated SQL DDL statements to create the user-defined type. You can also save
the generated SQL to a file to modify and run later.
Option Description
Database Name Select the database in which to create the user-define type. In this case, it
is always SYSTUDTLIB.
Type Name Specify the name of the user-defined type to create.
Define type Define the type for the user-defined type.
Edit Edit the user-defined type DDL to be created.
Type Summary Displays a summary of the type used by the user-defined type.
SQL Preview Review the SQL generated for the user-defined type you specify and run
the SQL to create the user-defined type. You can also save the generated
SQL to a file.
Reset Click Reset to clear the dialog fields before you define a new user-defined
type.

Teradata Studio User Guide, Release 15.10 163


Chapter 6 Development of Teradata Databases

Create Array User-Defined Type

The Create Array User-Defined Type dialog defines the database user-defined type and runs
the generated SQL DDL statements to create the user-defined type. You can also save the
generated SQL to a file.
The dialog contains the following elements:
Element Description
Database Name The name of the database in which to create the user-define type. In this
case, it is always SYSTUDTLIB.
Type Name Name of the user-defined type to create.
Define type Type for the user-defined type.
Type Summary Summary of the type used by the user-defined type.
SQL Preview Review of the SQL generated for the user-defined type you specified. You
can execute the SQL to create the user-defined type or save the generated
SQL to a file.
Reset Clears the dialog fields before you define a new user-defined type.

Edit Comments Dialog

The Edit Comments dialog allows the user to edit the comments for a selected Teradata
Database Object.
Comments text field - Allows user to edit comments.
Update button - Updates the selected database object comments.
Cancel button - Cancel the edit comments request.

Drop Confirmation

The Drop Confirmation dialog prompts the user to confirm dropping the object selected. It
also allows you to answer Yes to all of the objects in the selected list, thus bypassing the
confirmation dialog for each object in the list. It provides a button to cancel the request. The
following buttons are provided:
Button Description
Yes Drops the current object.
Yes to All Drops all objects in the selected list. The confirmation dialog is not
presented for each object in the list.
No Does not drop the current object.
Cancel Cancels the drop request.

164 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

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 y the MDS password
Test User Tests the user credentials. A list of available database systems is
displayed in a dialog box.
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:

Teradata Studio User Guide, Release 15.10 165


Chapter 6 Development of Teradata Databases

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
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 Default set of objects that refer to the selected object appears with
Objects the relationships between them.
Show Default Referred To Default set of objects to which the selected object refers appears in
Objects the 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.

166 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Action Description
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:
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

Teradata Studio User Guide, Release 15.10 167


Chapter 6 Development of Teradata Databases

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.

Meta Data Services Synchronization Issues

Synchronizing New Objects Added to the Database System


If new objects such as databases, tables, procedures, macros, or views are created or copied to
a Teradata system managed by Meta Data Services, you must run the Meta Data Services
MetaManager utility to re-synchronize the Meta Data Services repository in order for Meta
Data Services to recognize these new objects. To re-synchronize, bring up the Teradata Meta
Data Services MetaManager and select the Resync Database tab.

Loading Teradata System into the Meta Data Services Repository


In order to use Meta Data Services for finding dependent objects for a Teradata database
system, you must load the database system into the Meta Data Services repository. To load
the database, run the Teradata Meta Data Services MetaManager and select the Load
Database tab. You must create an ODBC Data Source for the Teradata system so that it is
recognized by the Meta Data Services utility.

Aster Database Development

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 Data
Source Explorer. To expand the structure, click the arrow beside an object name. For
example, to view schema objects, click the arrow to the left of Schemas. This expands the
Schema folder to show a list of the objects in the schema. At the same time, the Object
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

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.

168 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

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.

Action Bar
The action bar in the upper right corner allows you to:
Commit Executes the SQL to create the database.
Reset Clears all values entered in the form.
You must click Commit to create the database before you can assign privileges in
the Privileges tab.

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 Click the Teradata Administrator perspective tab or select Window > Teradata
Administrator to open the Teradata Administrator perspective.
2 In Data Source Explorer, click an Aster connection profile name.
The Object Viewer opens and displays the Databases, Users, and Roles associated with
the profile.
3 In the Object Viewer toolbar, click (Create a new Aster database).
4 Navigate to the Database object form which displays below the list of Databases in the
Object Viewer view.
5 Click General and type a Name for the new database.

Teradata Studio User Guide, Release 15.10 169


Chapter 6 Development of Teradata Databases

6 In Encoding, select the character set encoding to use for the new database.
The only valid value is UTF8 a variable-length character encoding for Unicode.
7 Click SQL.

a Review the generated DDL statements that will create the new database.

b [Optional] Modify the CREATE statement by returning to previous steps to change


your selections.
8 Click Commit to create the database.
9 Click Privileges and from the Grantee Type list select one of the following:
Users
Roles
PUBLIC
a With Grantee Type selected as Users, select a user to whom you want to grant rights
for this database.
b Double-click the selection boxes to the right of the user's name to assign the CREATE,
CREATE w/Grant, CONNECT, and/or CONNECT w/Grant privileges.
c With Grantee Type selected as Roles select a role to which you want to grant rights
to this database.
d Double-click the selection boxes to the right of the role's name to assign the CREATE,
CREATE w/Grant, CONNECT, and/or CONNECT w/Grant privileges.
e With Grantee Type selected as PUBLIC click public to grant the public role to this
database.
f Double-click the selection boxes to the right of public to assign the CREATE and/or
CONNECT privilege.
Note: Privileges you grant are shown as Grants. After you click COMMIT and
return to the Privileges tab, privileges change to Granted.

Object Name Description


Granted Privilege granted to object.
Not Granted Privilege not granted to object.
Granted but not Revocable Privilege granted and cannot be revoked.
Not Grantable Privilege cannot be granted to the object.
Grants Object selected to have privilege granted.
Revokes Object selected to have privilege revoked.

10 Click SQL to review the generated DDL with added GRANT and/or REVOKE
statements.

170 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

11 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. Clicking the icon toggles it to the opposite privilege, for
example, from granted to revoked, revoked to granted, not-granted to granted, and so
forth. Use the legend above the table to make sure you've set the privilege correctly.
Clicking Commit executes and saves your changes.

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 bytes.
Be allowed by PostgreSQL and cannot be a PostgreSQL keyword.
Cannot contain the prefix '_bee' which is reserved for Aster Database system object
names.
Cannot be a substring of the word 'database'.

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 Open Data Source Explorer.
2 Select the Aster Database connection profile associated with the Aster database you want
to drop.
3 In Object Viewer, click the Databases tab.
4 Select the database you want to drop from the Databases list.
You can select multiple databases to drop at one time.
5 On the Object Viewer toolbar, click .
A dialog appears and prompts you to confirm the drop.
6 Click OK.

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 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 Do one of the following:
In Data Source Explorer, right-click Schemas and select Aster > Create Schema.
In the Object Viewer toolbar, click .

Teradata Studio User Guide, Release 15.10 171


Chapter 6 Development of Teradata Databases

The Schema object form displays below the Object Viewer view.
3 Click General and type a Name for the new schema.
4 Click SQL.

a Review the generated DDL statements that will create the new schema.

b [Optional] Modify the CREATE statement by returning to previous steps to change


your selections or manually change the text of the DDL statement in the editor.
5 Click Commit to create the schema.
6 Click Privileges and select from the Grantee Type list one of the following:
Users
Roles
PUBLIC
a With Grantee Type selected as Users select a user to whom you want to grant rights
for this schema.
b Double-click the selection boxes to the right of the selected user's name to assign the
CREATE, CREATE w/Grant, USAGE, USAGE w/Grant, INSTALL FILE, or CREATE
FUNCTION privileges.
Note: The db_superuser is by default given the INSTALL FILE and CREATE
FUNCTION roles for this schema.
c With Grantee Type selected as Roles select a role to which you want to grant rights
to this schema.
d Double-click the selection boxes to the right of the selected role's name to assign the
CREATE, CREATE w/Grant, USAGE, USAGE w/Grant, INSTALL FILE, or CREATE
FUNCTION privileges.
e With Grantee Type selected as PUBLIC click public to grant the public role to this
schema.
f Double-click the selection boxes to the right of public to assign the CREATE, USAGE,
INSTALL FILE, and/or CREATE FUNCTION privileges.
Note: Privileges you grant are shown as "Grants". After you click COMMIT and
return to the Privileges tab, privileges change to "Granted".
7 Click SQL to review the generated DDL with added GRANT and/or REVOKE
statements.
8 Click Commit to set the privileges you selected for this schema.

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

172 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Schema Properties
Click the property option tabs in the left panel to view schema properties, such as
schema name, assigned privileges, and generated DDL, 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.
Action Bar
The action bar in the upper right corner allows you to execute SQL to create or
modify the schema definition. You can also reset the Schema form and begin again,
or cancel and close the form. 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 Open Data Source Explorer and navigate to the database associated with the Aster
schema you want to drop.
2 Click beside the database name to display the Schemas folder.
3 Do one of the following:
Right-click the schema to drop and select Aster > Drop Schema....
Select the Schemas folder and in the Object Viewer, select the schema you want to
drop and click (Drop the selected object).
4 When you are prompted to confirm the schema drop, click OK.

Teradata Studio User Guide, Release 15.10 173


Chapter 6 Development of Teradata Databases

Defining Aster Database Users

Creating an Aster Database User

1 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 In Data Source Explorer, click the Aster connection profile name for the Aster Database
in which you want to create a user.
The Object Viewer opens and displays the Users associated with the profile.
3 In the Object Viewer toolbar, click (Create a new Aster user).
4 Navigate to the Users object form which displays below the list of Users in the Object
Viewer main view.
5 Click General and type a name for the user.

a Type a Name for the new user.

b Type the user Password.

c In Confirm Password, retype the password you entered in the previous step.

d Select the Inherit check box to enable this user to automatically inherit group
privileges.
6 Review the generated SQL and click Commit to create the user.
After you create the user, you can continue to specify additional properties such as roles
for the user and object privileges.
7 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.

8 Click Object Privileges.

a Select the Object Type from the list.


The options are Database, Schema, Table, View, and Function.
b Select the Database that contains the objects on which you want to set privileges for
the user. You also can select to display objects in ALL databases.
c Set the privilege for each object you select in the Object Name column.
The legend above the table helps you to select the correct privilege.

174 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Object Name Description


Granted Privilege granted to object.
Not Granted Privilege not granted to object.
Granted but not Revocable Privilege granted and cannot be revoked.
Not Grantable Privilege cannot be granted to the object.
Grants Object selected to have privilege granted.
Revokes Object selected to have privilege revoked.

9 Click SQL.

a Review the DDL statement generated.

b Modify the CREATE statement by returning to previous steps to change your


selections.
10 Click Commit to execute the DDL statement and create the database user.

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.
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.

Teradata Studio User Guide, Release 15.10 175


Chapter 6 Development of Teradata Databases

Action Bar
The action bar in the upper right corner allows you to execute SQL to create the user
definition. You can also reset the User form and begin again, or cancel and close the
form. 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 Data Source Explorer, click the Aster Database connection profile that contains the
user you want to drop.
The Object Viewer displays the Databases, Users, and Roles for the selected Aster
Database.
2 Click the Users tab and in the User Name column select the user you want to drop.
You can select multiple users to drop at one time.
3 In the Object Viewer toolbar, click (Drop the selected object).
4 When prompted to confirm the drop, click OK.

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 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 Open Data Source Explorer.
3 Select the Aster Database connection profile for the database in which you want to create
a role.
4 In the Object Viewer toolbar, click (Create a new Aster role).
5 Navigate to the Roles object form which displays below the list of Roles in the Object
Viewer main pane.
6 Click General.

a Type a Name for the new role.

b Select the Inherit check box to specify this role inherits the privileges of roles of which
it is a member.
c Select the Role can create database check box to give the role the rights to create a
database object.

176 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

d Select the Role can create role check box to give the role rights to create a role.
7 Review the generated SQL and click Commit to create the role.
After you create the role, you can continue to specify role properties such as role
membership and rights to specific database objects.
8 Click In Roles and specify to which roles the new role will be added as a new member
with IN ROLE or IN ROLE w/Admin privileges.

Roles Description
In Role Role is a member in the role.
Not in Role Role is not a member in the role.
Add to Role Role selected to be added as a member to the role.
Remove from Role Role selected to be removed as a member of the role.

9 Click Members of Role and select the Member Type.


The options are User or Role.
10 For each user or role to be added as a member of this role, specify the MEMBER and/or
MEMBER w/Admin privileges.
Members of a role can use the privileges of the group role.

Role/User Name Description


Member of Role Role or User granted membership in the role.
Not Member of Role Role or User is not granted membership in the role.
Add as Member Role or User selected to be added as a member to this role.
Remove as Member Role or User selected to be removed as a member of this role.

11 Click Object Privileges.

a Select the Object Type from the list.


The options are Database, Schema, Table, View, and Function.
b Select the Database that contains the objects on which you want to set privileges. You
also can select to display objects in ALL databases.
c Set the CREATE, CREATE w/Grant, CONNECT, and/or CONNECT w/Grant
privilege for each object you select in the Object Name column.
The legend above the table helps you to select the correct privilege.

Object Name Description


Granted Privilege granted to object.
Not Granted Privilege not granted to object.
Granted but not Revocable Privilege granted and cannot be revoked.

Teradata Studio User Guide, Release 15.10 177


Chapter 6 Development of Teradata Databases

Object Name Description


Not Grantable Privilege cannot be granted to the object.
Grants Object selected to have privilege granted.
Revokes Object selected to have privilege revoked.

12 Click SQL.

a Review the DDL statement generated.

b Modify the CREATE statement by returning to previous steps to change your


selections or manually change the text of the DDL statement in the editor.
13 Click Commit to execute the DDL statement and create the database role.

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.

178 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Action Bar
The action bar in the upper right corner allows you to execute the SQL to create the
role, reset the form, or cancel and close the form. Be sure to commit your DDL 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 Data Source Explorer, click the Aster Database connection profile that contains the
role you want to drop.
The Object Viewer displays the Databases, Users, and Roles for the selected Aster
Database.
2 Click the Roles tab and in the Role Name column select the role you want to drop.
You can select multiple roles to drop at one time.
3 In the Object Viewer toolbar, click (Drop the selected object).
4 When prompted to confirm the drop, click OK.

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.
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.

Teradata Studio User Guide, Release 15.10 179


Chapter 6 Development of Teradata Databases

Do not create analytic tables as parent/child tables with inheritance.

Creating an Aster Table


When you create an Aster schema, the Data Source Explorer displays a Tables folder under
the schema where you can create tables. 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.
1 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.
2 Do one of the following:
In Data Source Explorer, locate the schema in which you want to create a new table,
expand the schema folder, and right-click Tables to select the Aster > Create Table
option.
In the Object Viewer toolbar, click .
The Table object form displays below the Object Viewer view.
3 In the General tab, type a Name for the new table.
4 Select the Persistence level from these options:

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.
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.

5 Select the Table Type from these options:

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.
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 Distributed by field,
select the column you want to be the key distribution column from the list.
6 Click Columns and for each column you add to the table, complete the following
information:
a Type the name of the new column in the Column Name field.

180 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

b Select the Data Type to use for the column from the list.

c In the Length field, 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 the Null checkbox if data values in this column can be null.
g Select the Unique checkbox if data values in this column must be unique.

h [Optional] Type a Default value if appropriate for the column type.


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.
7 [Optional] To add another column to the table, click Add and repeat the previous step.
8 [Optional] To remove a column from the table, select a Column Name and click
Remove.
9 [Optional] To reorder columns, select a column and click Up and Down to move its
position.
10 [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 of HIGH, MEDIUM, or LOW.

c In the Index Members section, click Add.

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.

Teradata Studio User Guide, Release 15.10 181


Chapter 6 Development of Teradata Databases

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.
11 [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.


Options are UNIQUE, PRIMARY KEY, or CHECK. 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, select 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.
12 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 the Storage by Row check box if you want the table data stored by the table row.
If you do not select the check box, data storage is by column.
c In Compress select the level of compression for an existing partition: HIGH,
MEDIUM, or LOW.
The default is HIGH.
d In Inherits, accept the default value "inherits" or type a different value.
Inherits indicates whether or not the table has an inheritance relationship with a
parent table.
e 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.
13 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.

182 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

14 Click Privileges and from the Grantee Type list select one of the following:
Users
Roles
PUBLIC
a With Grantee Type selected as Users select a user to whom you want to grant rights
to this table.
b Double-click the selection boxes to the right of the user's name to assign the SELECT,
SELECT w/Grant, INSERT, INSERT w/Grant, UPDATE, UPDATE w/Grant, and/or
DELETE, DELETE w/Grant privileges.
c With Grantee Type selected as Roles select a role to which you want to grant rights
to this database.
d Double-click the selection boxes to the right of the role's name to assign the SELECT,
SELECT w/Grant, INSERT, INSERT w/Grant, UPDATE, UPDATE w/Grant, and/or
DELETE, DELETE w/Grant privileges.
e With Grantee Type selected as PUBLIC click public to grant the public role to this
database.
f Double-click the selection boxes to the right of public to assign the SELECT, INSERT,
UPDATE, and/or DELETE privileges.
Note: Privileges you grant are shown as Grants. After you click COMMIT and
return to the Privileges tab, privileges change to Granted.
15 Click SQL and review the generated DDL statement.
To modify the CREATE TABLE statement, return to previous steps to change your
selections. You can also copy and paste the DDL text into an SQL Editor to make edits.
16 Click Commit to execute the DDL 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.

Teradata Studio User Guide, Release 15.10 183


Chapter 6 Development of Teradata Databases

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.
Indexes Specify the indexes for a new table.
Contraints 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.
Action Bar
The action bar in the upper right corner allows you to execute SQL to create or
modify the table definition. You can also reset the Table form and begin again, or
cancel and close the form. 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 Open Data Source Explorer and navigate to the Tables folder that contains the table you
want to drop.
2 Do one of the following:
Right-click a table and select Aster > Drop....

184 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

Select the Tables folder and in the Object Viewer, select the table you want to drop
and click (Drop the selected object).
3 When you are prompted to confirm the table drop, click OK.

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 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.
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 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 Click the Teradata Administrator tab or select Window > Teradata Administrator to
open the Teradata Administrator perspective.

Teradata Studio User Guide, Release 15.10 185


Chapter 6 Development of Teradata Databases

2 Do one of the following:


In Data Source Explorer, expand the Schemas folder, and right-click Views to select
Aster > Create View.
In the Object Viewer toolbar, click .
The View object form displays below the list of Views in the Object Viewer main view.
3 Click the General tab and type a Name for the new view.
4 Click the View Query tab.

a Specify one or more source tables in the SELECT " FROM clause.
You may enter the table name manually or right-click in the pane below the Query
editor pane to use the Add Table dialog.
b Select the DISTINCT check box to remove all duplicate rows from the result set.
The first row is retained for each set of rows that are duplicates.
c Review the summary information for the tables you include in the view.
Summary information includes Columns, Conditions, Groups, and Group
Conditions.
5 Review the generated SQL and click Commit to create the view.
After you create the view, you can continue to specify additional properties such as
privileges.
6 Click Privileges in the left panel.

7 In Grantee Type, select one of the following from the list:


Users
Roles
PUBLIC
a With Grantee Type selected as Users, select the user for whom you want to modify
rights to this view.
b Double-click the selection boxes to the right of the selected user's name to grant the
SELECT and/or SELECT w/Grant privilege.
c With Grantee Type selected as Roles, select the role for which you want to grant
rights to this view.
d Double-click the selection boxes to the right of the selected role's name to grant the
SELECT and/or SELECT w/Grant privilege.
e With Grantee Type selected as PUBLIC, click public to grant the public role on this
schema.
f Double-click the selection box to the right of public to grant the SELECT privilege.
Any new privileges you might grant are shown as Grants. After you click COMMIT
and return to the Privileges tab, privileges change to Granted.

186 Teradata Studio User Guide, Release 15.10


Chapter 6 Development of Teradata Databases

8 Click SQL and review the generated DDL statement used to create the new view.
To modify the CREATE VIEW statement, return to previous steps to change your
selections.
9 Click Commit to execute the DDL statement and create the view in the Aster Database.

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.

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.
Action Bar
The action bar in the upper right corner allows you to execute SQL to create or
modify the view definition. You can also reset the View form and begin again, or
cancel and close the form. 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 Open Data Source Explorer and navigate to the schema that contains the view you want
to drop.
2 Expand the schema folder to display the Views it contains.

Teradata Studio User Guide, Release 15.10 187


Chapter 6 Development of Teradata Databases

3 Do one of the following:


Right-click the view to drop from the schema and select Aster > Drop....
Select the Views folder and in the Object Viewer, select the view you want to drop and
click (Drop the selected object).
4 When you are prompted to confirm the view drop, click OK.

188 Teradata Studio User Guide, Release 15.10


CHAPTER 7

Teradata Data Labs

About the Data Lab View


The Data Lab View provides access to your tables from a Teradata 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.
The Data Lab View 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 15.10 189


Chapter 7 Teradata Data Labs

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 Select Window > Show View > Data Lab View to open the Data Lab View.

190 Teradata Studio User Guide, Release 15.10


Chapter 7 Teradata Data Labs

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.
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.
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.

Teradata Studio User Guide, Release 15.10 191


Chapter 7 Teradata Data Labs

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.
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 consists of several screen interfaces:
Interface 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
screen.

192 Teradata Studio User Guide, Release 15.10


Chapter 7 Teradata Data Labs

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.

Teradata Studio User Guide, Release 15.10 193


Chapter 7 Teradata Data Labs

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.

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.

194 Teradata Studio User Guide, Release 15.10


Chapter 7 Teradata Data Labs

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.

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.

Teradata Studio User Guide, Release 15.10 195


Chapter 7 Teradata Data Labs

196 Teradata Studio User Guide, Release 15.10


CHAPTER 8

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.
Teradata Execution Plan View Enables you to use the Object Viewer to compare execution
plans that reside in the Query Capture Database (QCD).
Statistics Collection View Collects the statistics on table columns and indexes that are
important to producing query plans.

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 15.10 197


Chapter 8 Query Development

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 when content validation. The message displays if the number of lines in
exceeds maximum number the SQL file exceeds the value entered in Maximum
of lines number of lines.
Show detailed annotation When selected enables the SQL Editor to display the list of
information possible 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
delimiters for execution.
Execute current line Selects only the currently selected line of SQL code is to be
executed.
Execute SQLs between Selects to use blank lines as the delimiters for separating
blank lines SQL statements for execution.

198 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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

Teradata Studio User Guide, Release 15.10 199


Chapter 8 Query Development

Main Option Description


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 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 Places a line break before the
with 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.

The following options are used to control changes:


Option Description
Apply Saves the new SQL Formatter Preferences
Restore Defaults Restores the SQL Formatter Preferences to their
default values
OK Saves the new SQL Formatter Preferences and
exits
Cancel Cancels any changes and exits

200 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Teradata SQL Editor

About the SQL Editor

The SQL Editor provides an integrated environment for the development of SQL files that
enables 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.

Connected Profile Name


Selects the profile in which to run the SQL script. You must connect to a Connection
Profile to display the Connection Profile name in the list.
Editor Workarea
Displays the active SQL edit window. You can insert, delete, and modify SQL
statements displayed in this area.
Connection Indicator
Shows the status of the connection to the selected Connection Profile. Green
indicates that the connection is active.
Autocommit
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.

Teradata Studio User Guide, Release 15.10 201


Chapter 8 Query Development

Execute
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.
Save
Displays a list of Save options. You can select to Save to Project or Export to File
System.
New SQL Editor
Creates a new SQL Editor window displayed in a separate tab.
View Result Sets
Displays the associated result sets for the SQL query execution.
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.

Opening a Non-Teradata or Non-Aster SQL Editor


The Teradata SQL Editor supports only Teradata Database and Aster Database connection
profiles. 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.

202 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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 Toolbar

The SQL Editor toolbar enables Connection Profile selection and action buttons that help
you manage and execute SQL for Teradata databases.

Connection Profile
Use the following features to connect to a Teradata database using a Connection Profile.
Option Description
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.
Profile is connected.

Profile is disconnected.

Actions
Click toolbar icons to perform tasks. The active task displays. To select a different option, use
the selection list to the right of the active icon.
Icon Option Description
Execute SQL as Executes all SQL statements or selected statements one at a time,
individual displaying the result as a Teradata Group Execution in the SQL
statements 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 SQL as one Executes the line in the SQL file designated by the current cursor
statement position.
Save to Project Saves the SQL file to a project.

Teradata Studio User Guide, Release 15.10 203


Chapter 8 Query Development

Icon Option Description


Export to file system Exports the active SQL file from the project to the file system.

Open a new SQL Opens a new SQL Editor. This action does not close the current
Editor editor, enabling you to work with multiple editors in tandem

Execute SQL

The SQL Editor provides various options to execute SQL statements within an SQL file. To
access the following options, 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.
Run Configurations let you define operations that you can run from the Run menu and
Run toolbar button.
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 popup 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.

204 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.
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
and Toolbar topic for details of how to rerun, edit and remove the automatically created
launch configurations.

Running SQL from Run Menu

Run Configurations
Run configurations let you manage and run SQL statements that you want to run on a
regular basis. The Teradata Studio Run menu gives you the ability to specify and run your
frequently used SQL operations.

Using Run Configurations


You manage your run configurations using the Run Configurations dialog. It is used to
create, manage and run SQL operations. To use the Run Configurations dialog, do the
following:
1. Select Run configurations from the Run menu.
2. Click New Launch Configuration ( ). You can also edit an existing launch
configuration by selecting it in the left pane. You can duplicate an existing launch
configuration by selecting it and pressing the Duplicate Launch Configuration button
( ).
3. Enter a unique Name for the launch configuration.
4. On the Main tab, select a connection Profile and Database.
5. Select the type of object your run configuration is running. (Macros are included in the
list of choices when you select Stored Procedure.)
6. If you selected a choice other than Adhoc SQL click Browse to select the object. (This
can take a long time to respond. The names of all objects of the selected type in each
visible database are shown in the list. The first time this is done all the definitions of the
objects are retrieved from the database.)
7. In Run, complete the information necessary to run the object or SQL:
Object Type Further steps to complete
Stored Procedure, Macro, Click Configure Parameters and assign values to any
User-defined Function parameters.
Trigger Enter an INSERT, UPDATE, or DELETE statement in the Run
text field, or click SQL to visually build the statement using the
Visual SQL Query Builder. The statement should be one that
performs the operation on the table specified by the selected
trigger.
Adhoc SQL Enter the SQL to be run in the Run text field, or click the SQL
button to visually build the statement using the Visual SQL
Query Builder.

Teradata Studio User Guide, Release 15.10 205


Chapter 8 Query Development

8. [Optional] Click the Common tab to set other attributes for the run configuration.
Option Description
Save as Specify where to save the run configuration:
Select Local file to make it available to this project only.
Select Shared file to save the file in your project. Specify the
folder to hold the run configuration by clicking Browse
button. A file with the run configuration name plus the
suffix ".launch" is created in the specified folder of your
project. The ".launch" file can be copied to other projects. All
launch configurations in your projects are included in the
list.
Display in favorites menu Check Run to have the configuration always shown in the Run
History list of the Run menu. (Several recently run launch
configurations also are shown in the Run History.)
Other fields Other fields in the Common tab do not apply to SQL launch
configurations. Setting them has no effect.

Run last
Selecting the Run item from the Run menu reruns the latest SQL operation that was run.

Automatically Created Run Configurations


When you run a Stored Procedure, User-defined Function, Macro or Trigger by right-
clicking on an object's name in the Data Source Explorer and selecting Run from the popup
menu, a launch configuration for the object automatically is created. The launch
configuration has the name of the object that you ran (that is, the name of the stored
procedure, UDF, macro or trigger). The parameters (if any) that were specified when the
object was run are saved in the launch configuration. If you run the same object multiple
times this way, multiple launch configurations are created whose names is the object name
with a number in parentheses appended.

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:

206 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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 the Query Development tab 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

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 the Query Development tab 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

Teradata Studio User Guide, Release 15.10 207


Chapter 8 Query Development

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 the Query Development tab 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 > 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.

208 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.

Updating Table Rows using an UPDATE Template


You can generate an UPDATE statement template in the SQL Editor to update table rows.
1 Click the Query Development tab 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 > 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.

Teradata Studio User Guide, Release 15.10 209


Chapter 8 Query Development

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 the Query Development tab 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.

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 the Query Development tab to open the perspective and launch the SQL Editor.
The SQL Editor, Result Set Viewer, and Teradata SQL History views open.

210 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.

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.

Teradata Studio User Guide, Release 15.10 211


Chapter 8 Query Development

Select All and Deselect All


You can select all listed objects by clicking Select All. You can also select the objects
individually by checking the box beside the object type name. If you want to clear your
selections, click Deselect All.
The Compare Objects results display in the Compare Editor.

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.
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:

212 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.

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.

Teradata Studio User Guide, Release 15.10 213


Chapter 8 Query Development

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.

214 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.

Teradata Studio User Guide, Release 15.10 215


Chapter 8 Query Development

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.

216 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

If you select a database that does not contain tables, the message "No Tables" displays
below the database list.
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.

Teradata Studio User Guide, Release 15.10 217


Chapter 8 Query Development

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.

218 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.

Teradata Studio User Guide, Release 15.10 219


Chapter 8 Query Development

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.

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.

220 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Compare SQL Objects

Compare SQL Objects Wizard

The 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 a Teradata or Aster
Database to which you can connect. You can compare database, user, table, macro, stored
procedure, user-defined function, user-defined type, and view objects in Teradata Databases.
You can compare schemas, Map Reduce functions, tables, user-defined functions, and views
in Aster Databases. The wizard uses the Teradata DDL Generator to generate the DDL for
the selected options.
Use the Compare Objects screen to select the object to compare with the referenced object
you selected in Data Source Explorer.

Select Connection Profile


To select the object, use the Select Connection Profile list. Only profiles to which you are
connected display in the list. 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.

List of Teradata Database Objects


After you select a Teradata connection profile, a list of connected databases displays in the
Database pane. Select the database that contains the object you want to compare with.

Compare-to Teradata Database


If you selected a database in Data Source Explorer, a list of databases displays in the
Database pane, and you are not asked for any further information. You can choose to either
click Finish to begin the DDL compare operation or click Next to specify additional objects
to include in the comparison.

Compare-to Teradata Object


If you selected a database object, such as a Table object, in Data Source Explorer, a list of
table objects for the selected database displays in the Table pane. Select the Table object to
compare with the referenced Table object you selected in Data Source Explorer.
You can begin the compare object operation by clicking Finish or you can go to a second
screen by clicking Next to select additional object types to include in the comparison.
The Compare Objects results display in the Compare Editor.

List of Aster Schema Objects


After you select an Aster connection profile, a list of schemas in the connected database
displays in the Schemas pane. Select the schema that contains the object you want to
compare with.

Compare-to Aster Schema Object


If you selected an Aster schema object in Data Source Explorer, a list of schemas in the
Aster Database displays in the Schema pane. Objects of the same type as the selected object

Teradata Studio User Guide, Release 15.10 221


Chapter 8 Query Development

display in the pane below. To compare the referenced object, select a different object in the
list to which you want the referenced object compared.
The Compare Objects results display in the Compare Editor.

About the Compare SQL Object Wizard


The 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 to which you can connect.
When you select a referenced object for the comparison in Data Source Explorer and then
select the object with which you want to compare it, the Compare SQL Objects dialog opens.

Connection Profile
The Select Connection Profile field provides a list of the profiles which are currently
connected. If the Connection Profile you want is not listed, go to the Data Source
Explorer and right-click Database Connections to connect to the correct database.
List of Objects for Compare
The Database field shows the objects in the Connection Profile database you
selected. Navigate to the object you want to compare with the referenced object, and
select it.

Objects to Include
If there are dependent objects you want to include in the comparison, you can select
these objects in the second Compare Objects screen. If an object has no dependent
objects, the screen is blank.

222 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Including additional objects is optional. By default, the Compare SQL Object


Wizard compares only the objects you select with the referenced object.

Select or Deselect
When selecting additional objects to include, you can select objects one by one or use
the Select All and Deselect All buttons at the bottom of the screen to make your
selection.
Compare Results
When you are ready to perform the comparison and click Finish the results of the
comparison appear in the Compare Editor.

Related Topics
About the Compare Editor, on page 218

Teradata Studio User Guide, Release 15.10 223


Chapter 8 Query Development

Result Set Viewer

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.
Query
Set Focus to
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
Display text. The default is grid.
Format Click to open the platform specific Font dialog which enables
Selected Cells you to select the font, size, and color (on most platforms) of
the selected cells.
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:

224 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Icon Option Description


Preferences Click to open the Result Set Viewer Preferences page.

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

Rename Result Tab Click to open a dialog that allows you to rename the result
tab.
Rename Group Result Select one of the group result tabs while in Tab display
Tab mode. Right- click the tab and select the Rename Group
Result tab menu option.
Text or Grid Display Click to switch the view of the result set data between grid
or text. The default is grid.
Sash or Tab Display Click to switch the display of the multiple result sets
between a tab 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.

Refresh Result Set List Click to re-display all of the removed result sets.

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 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

Teradata Studio User Guide, Release 15.10 225


Chapter 8 Query Development

Icon Option Description


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 Columns Click to show all columns. Previously hidden columns are
also shown.
Auto resize column Click to resize the column to fit the largest cell.
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.
Format Selected Cells Click to open the platform specific Font dialog which
enables you to select the font, size, and color (on most
platforms) of the selected cells.

226 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Icon Option Description


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 Left-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.
You can set the following preferences:
Option Description
Alternating Row Colors Display alternate Result Set rows in color Displays the
Option result set with alternating row background colors. This option
can be enabled by selecting the box. You can select a different
background color by clicking on the 'color' button. This option
is disabled by default.

Teradata Studio User Guide, Release 15.10 227


Chapter 8 Query Development

Option Description
Display alternate Result Set Select the check box to display color in alternate rows of the result
rows in color set. Click the color box to open the Color dialog and select a basic
color or define a custom color to use.
Grid Display Options Show Row Numbers Displays row numbers. This option is
enabled by default.
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 rather than Column Names
Displays the column titles (if available) rather than the column
names, in the column header area. This option is disabled by
default.
Note: 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.
Note: The query must be rerun in order for a change to this
option to take effect.
Display Null Value as Changes the value that is displayed
when the data is null. The default for this options is "null".
Format Options 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 1000 Separator in Numeric Columns Displays a
1000 separator in numeric columns. This option is disabled by
default.
Display Negative Numbers in Red Displays negative
numbers in red. This option is enabled by default.
Display Date Format Changes the date format. 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.
Copy Column Delimiter 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.

228 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Option Description
Viewer Window Options Select the Reuse Result Set Viewer Window check box to cause the
Result Set Viewer to refresh the current window with new 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.
Action Buttons Restore Defaults Restores the default values for the options.
Apply Applies any option changes. This might cause a
refresh of the current result sets displayed in the Result Set
Viewer.
OK Applies option changes and closes the Preferences page.
This might cause a refresh of the current result sets displayed in
the Result Set Viewer.

Setting Result Set Viewer Preferences


Use the Teradata Result Set Viewer preferences to configure views of result-set data.
1 Click Window in the top menu and select Preferences.
2 Expand Teradata Datatools Preferences.
3 Select Result Set Viewer Preferences.
4 [Optional] Under Alternating Row Colors Option, enable the display of an alternate
row background color:
a Select the Display alternate Result Set rows in color check box.

b Right-click the color box, and select a color in the Color dialog.

c Click OK.
5 Under Grid Display Options, select the following options as appropriate:

Option Description
Show Row Numbers Select to show row numbers in the grid display. This option is enabled
by default.
Show Column Select to show column headers in the grid display. This option is
Headers enabled by default.
Show Table Grid Select to display lines between rows and columns in table grid display.
Lines This options is enabled by default.
(*) Display Column Select to display column titles (if available) instead of column names as
Titles rather than labels in column headers. This option is disabled by default.
Column Names
Note: You must rerun the query to effect any change you make.

(*) Max Display Row Specify the maximum number of rows to display. The default value is
Count 2000.
Note: You must be rerun the query to effect any change you make.

Teradata Studio User Guide, Release 15.10 229


Chapter 8 Query Development

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.

6 Under Format Options, select the following options as appropriate:

Option Description
Long Text Type the number of characters allowed for the long text boundary size.
Boundary Size Default is 150 characters. If a data value length is longer than the long text
boundary size, only the first 20 characters display. You can view the entire
data value by double-clicking the value in the display grid. The value
displays in a new window.
Display 1000 Select to display a 1000 separator in numeric columns. This option is
Separator in disabled by default.
Numeric Columns
Display Negative Select to enable display of negative numbers in red. The options is enabled
Numbers in Red by default.
Display Date Specify the format to use to display the date in the result set. Default
Format format is yyyy-mm-dd. When you specify the format, you must use the
Java SimpleDateFormat notation to format the date.

7 Under Copy Column Delimiter, in the Delimiter Format field, select how you want
columns delimited when the Copy data option is used on the grid display.

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 Type the delimiter you want to use in the Delimiter Value field.

8 [Optional] Under Delimiter Value, select the following options as appropriate: you want
column headers delimited when the Copy data option is used on the grid display.

Option Description
Copy Include Column Specifies to include column headers as delimited values when the Copy
Headers data option is used on the grid display.
Copy Include Grid Specifies to include grid lines as delimited values when the Copy data
Lines option is used on the grid display.

9 [Optional] Under Viewer Window Options, select Reuse Result Set Viewer Window if
you want newly generated result sets to display in the currently open Viewer window. If
the check box is not selected, each new result set displays in a separate window in the
Result Set Viewer.
10 [Optional] To clear selections and restore default settings, click Restore Defaults.
11 To apply your changes, click Apply.

230 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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

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.
The Font dialog displays.

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.
The Choose a Background Color dialog displays.

Teradata Studio User Guide, Release 15.10 231


Chapter 8 Query Development

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.

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) Deselect 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
Editor the 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 theTeradata Export Wizard .

232 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Option Description
(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.

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.

Teradata Studio User Guide, Release 15.10 233


Chapter 8 Query Development

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.

Actions
Option Description
Success Sound Test Click to hear the sound you selected as the indicator of a
successful result.
Failure Sound Test Click to hear the sound you selected as the indicator of a
failed result.
Apply Click to apply your changes.
Restore Defaults Click to return settings to default values.
OK Click to save your preference settings.

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.

234 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

c Under Results Handler, the Teradata Result Set Viewer is selected as the results
handler for processing SQL result sets.
There is only this one option.
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 0 (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.
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
colummn size which when exceeded, the object is handled as a binary large object
(BLOB).
Note: A value of 0 (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.

SQL History View

SQL History View

The SQL History view 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 view 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

Teradata Studio User Guide, Release 15.10 235


Chapter 8 Query Development

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 view 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.

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.

236 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Icon Option Description


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.

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.

Teradata Studio User Guide, Release 15.10 237


Chapter 8 Query Development

Icons Option Description


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 View

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.

238 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Perspective Tab
The SQL History view displays when you select the Query Development
Perspective. You also can open the view from the main menu by selecting Window >
Show View > SQL History.
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
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.

Teradata Studio User Guide, Release 15.10 239


Chapter 8 Query Development

Option Icon Label Description


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.

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.
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:
Option Description
Exclude Explain Statements Check this box to exclude EXPLAIN statements in the
History database.

240 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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

History Rows
In Limit History View Rows, type the maximum number of rows allowed to display in the
Teradata SQL History view.

History View Columns Settings


Use action buttons to select and move columns between the Selected Columns panel and
the Available Columns panel.
Column Actions Description
Remove Removes the column you select from the Selected
Columns list.
Remove All Removes all columns shown in the Selected Columns
list.
Add Moves a column from the Available Columns list to the
Selected Columns list.
Add All Adds all columns in the Available Columns list to the
Selected Columns list.
Move Up Moves a selected column one position up in the list.
Move 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 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

Teradata Studio User Guide, Release 15.10 241


Chapter 8 Query Development

Column Options Description


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.

Execution Plans

About Comparing Execution Plans

The execution plans are displayed side-by-side within the Object Viewer along with the
ability to gather and view Statistics pertaining to an execution plan.

Compare Graphic Execution Plans

The individual plans are displayed as they would appear in the Execution Plan View. The
table is arranged as a column for each graphic execution plan. Each plan can be scrolled up
or down by moving the scroll bar. The columns can be expanded by moving the sash dividing
the columns.

Execution Plan List

The name of the profile is in parenthesis within the Execution Plan List tab label.
Icon Title Description
Statistics Indicates that the execution plan contains statistics data.

Select Plan Select the check box to select an execution plan from the
list.

242 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Icon Title Description


Query ID QCD query identifier for the execution plan.
SQL File Name Name given to the execution plan. This was based off the
SQL Editor full pathname (Project's package name/SQL File
name) when the execution plan was created.
Query Text Query text that was run for the execution plan.

Clicking the Query ID or SQL File Name column headers sorts the table of column
information with respect to the information in that table column. Clicking the same column
header again reverses the order of the sort.

Compare Execution Plans Tab


The table is arranged by step number with a column for each execution plan.
Each step text cell can be scrolled up or down by moving the scroll bar.
The columns can be expanded by moving the sash dividing the columns.

Compare Step Attributes Tab

Select a step from each graphic plan and the step attributes are displayed for the selected
steps in a table format. The columns can be expanded by moving the sash dividing the
columns.

Display Statistics Tab

The display shows the list of tables on the left side and the statistical attributes and data on
the right side. When you select a column from one of the tables on the left, the statistical
data is reflected in the information on the right.
The Get Execution Plan with Statistics option executes an INSERT EXPLAIN WITH
STATISTICS command for the SQL Statement. The statistic data is placed in the
TableStatistics table within the QCD database. The statistics data is then gathered by
running a HELP STATISTICS command with the given table name, column name, and
query ID. HELP STATISTICS retrieves the information from the TableStatistics table.

Execution Plan List Actions

Icon Title Description


Compare Execution If two or more plans are selected, displays a step text
Plans comparison of the selected execution plans.
Compare Graphic If two or more plans are selected, displays a graphic
Execution Plans comparison of the selected execution plans.
Display Statistics If a single statistics plan is selected, displays the table
level statistics for the selected execution plan.

Teradata Studio User Guide, Release 15.10 243


Chapter 8 Query Development

Icon Title Description


Delete Execution Plan Displays a confirmation dialog box asking if you want
to delete the selected execution plan(s). If the answer
is yes, the execution plans are deleted from the QCD.
Refresh Execution Plan Goes back to the QCD and refreshes the list of
List execution plans.
Hide Query Text Toggle action, which when clicked, hides the Query
Text from being displayed in the Execution Plan List
table. Click again to turn on the display of the Query
Text.

Execution Plan Options

Icon Title Description


Get Execution Enabled if the Connection Profile is connected. The
Plan command executes an EXPLAIN command for the SQL
Statement and displays the execution plan in the Execution
Plan view. If you selected the Text plan type, the Execution
Plan is displayed as text. If you selected the Graphic plan
type, the INSERT EXPLAIN command executes and inserts
the plan steps in the QCD database. The Execution Plan is
then displayed in a tree node hierarchy.
Get Execution Enabled if the user's connection profile is connected and the
Plans with user has chosen to use the Graphic plan type, in the SQL
Statistics Development > Execution Plan View option. The command
executes an INSERT EXPLAIN WITH STATISTICS
command for the SQL Statement. The statistic data is placed
in the TableStatistics table within the QCD database. The
statistics data is then gathered by running a HELP
STATISTICS command with the given table name, column
name, and query ID. HELP STATISTICS retrieves the
information from the TableStatistics table.
Compare Enabled if the Connection Profile is connected, and you
Execution Plans selected to use the Graphic plan type in the SQL
Development > Execution Plan View option. The command
displays a list of the execution plans contained in the QCD
(Query Capture Database)for the given profile. The list is
displayed in the Teradata View. The name of the profile
displays in parenthesis within the Execution Plan List tab
label.

244 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Graphic Comparison Actions

Icon Title Description


Compare Step Attributes Provides a step attribute comparison of the selected
steps.
Execution Plan List Returns to the Execution Plan List tab.

Reset Comparison Re-displays the graphic plan comparison with the


Display original column alignments. This is useful if you have
resized your columns and wish to return to its
original display.

Teradata Query Capture Database

The QCF requires a Query Capture Database (QCD) that contains specific table definitions.
An INSERT EXPLAIN INTO your_qcd_name AS name_of_SQL_File
SQL_Statement command is executed to create and insert the step information into the
QCD. The SQL File name for your SQL statement is also stored in the QCD using the AS
name_of_SQL_File clause.
You must create the QCD database before attempting the Get Execution Plan or Get
Execution Plan with Statistics option from within the SQL Tools selection menu. You
create the QCD database by clicking Create QCD Database to open the Create Database
dialog. You can also refer to a QCD that was created using the Teradata Visual Explain
product Control Center or to an existing database as your designated QCD database.
If you are using the Teradata Visual Explain product to create your QCD database, the QCD
tables are created automatically. If you used the Create Database dialog or manually created
your QCD database using an SQL command, you must create the QCD tables. To create the
tables, click Create QCD Tables.
Note: You must have SELECT, EXECUTE, and INSERT privilege on the QCD. If the QCD
and its tables are created by the preference screen, CREATE and REPLACE privileges are also
required.
Element Description
Connected Profile List of currently connected profiles. Select the name of the connected
Name profile to use when getting the execution plan.
QCD Database Name List of databases for the connected profile you selected. Select the QCD
database name to use when getting the execution plan.
Create QCD To enable this button, select a connected profile. It opens the Create
Database dialog.
Create QCD Tables To enable this button, select a database from the database selection list. It
is used to create the QCD tables in the QCD database. A confirmation
message indicates the tables were created successfully.
Save Association To enable this button, select a profile and database. It is used to save the
profile/QCD database names in the association table.

Teradata Studio User Guide, Release 15.10 245


Chapter 8 Query Development

Element Description
Profile/QCD Contains the list of profile/QCD database name associations. The
Association Table associations are stored in the user workspace and used by the Teradata
Execution Plan Service when one of the following requests is made:
Get Execution Plan or
Get Execution Plan with Statistics - provides the capability to run the
INSERT EXPLAIN command WITH STATISTICS. This indicates
that statistics for the WHERE clause condition columns specified in the
SQL_Statement are to be captured. This is equivalent to performing
COLLECT STATISTICS (QCD Form) on the query table columns.
The columns inserted into the QCD are those determined to be index
candidates by the Teradata Index Wizard.
Note: You must create the QCD database before attempting the Get
Execution Plan or Get Execution Plan with Statistics option from
within the SQL Tools selection menu. You create the QCD database by
clicking Create QCD Database to open the Create Database dialog.
You can refer to a QCD that was created using the Teradata Visual
Explain product Control Center or to an existing database as your
designated QCD database.
Remove Association To enable this button, profile/QCD database name associations must exist
in the Association Table. Select the profile name and click Remove
Association to remove a profile/QCD database name association from the
table.
Statistics Sample Percentage of data to be read for collecting statistics when the user chooses
Percentage % the Get Execution Plan with Statistics SQL Tools menu option. Valid
percentage values are between 0 and 100. A value of 0 indicates that the
option is not used. Otherwise, the USING SAMPLE clause is added to the
INSERT EXPLAIN WITH STATISTICS command to create the
execution plan in the QCD.

Statistics Data Actions

Icon Title Description


Execution Plan List Opens the Execution Plan List tab.

Step Attribute Comparison Actions

Icon Title Description


Execution Plan List Opens the Execution Plan List tab.

246 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Comparison Actions

Icon Title Description


Execution Plan List Opens the Execution Plan List tab.

Reset Comparison Display Re-displays the step text comparison with


the original column and cell alignments.
This is useful if you resized your columns
and want to return to the original display.

Teradata Execution Plan Preferences

The SQL Development Execution Plan View Preference dialog enables you to configure the
execution plan option type and Query Capture Database associations. Plan Types - Select
the execution plan type. Use the drop down list of supported plan types to select a type.
Plan Type Description
XML The system provides the plan displayed in XML format. This
option is only supported on Teradata version 13.0 and higher.
When getting the execution plan for Macro routines, the Teradata
Execution Plan service only supports the Text plan type.
Graphical You must provide a Query Capture Database (QCD).
Query Capture Database You must specify the name of the connection profile and its
associated QCD database name.

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.
The Teradata Plug-in for Eclipse and Studio products provide this view as a way for you to
collect statistics on the required collection objects.
These options are available for adding columns or indexes to the statistics view:

Teradata Studio User Guide, Release 15.10 247


Chapter 8 Query Development

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 selectingTeradata >
Statistics > Collect.
Drag and drop to Statistics Collection Selects columns or indexes from the Data Source Explorer
View to 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.

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.

248 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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 Displays a check mark when the collection objects already have statistics defined
Statistics 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.
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.
Length The 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.

Teradata Studio User Guide, Release 15.10 249


Chapter 8 Query Development

Option Description
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
Ordering select 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:
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.

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.

250 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

Use these options to drop statistics:


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.

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 greater than ( ) operator and enter the value 999.

Teradata Studio User Guide, Release 15.10 251


Chapter 8 Query Development

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

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.

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:

252 Teradata Studio User Guide, Release 15.10


Chapter 8 Query Development

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.
An Outline Viewer is displayed to the right of the graphical display. This shows a high-level
outline view of the SQL Statements.

Teradata Studio User Guide, Release 15.10 253


Chapter 8 Query Development

254 Teradata Studio User Guide, Release 15.10


CHAPTER 9

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.

Teradata Studio User Guide, Release 15.10 255


Chapter 9 Table Data Development

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.
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.

256 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.

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
Export is 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.

Teradata Studio User Guide, Release 15.10 257


Chapter 9 Table Data Development

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.
Select All description
Right to left Reading order description
Show Unicode control description
characters
Insert Unicode control Select from the list the Unicode control character to insert.
character
Open IME description
Reconversion description

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

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.

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.

258 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.

Teradata Studio User Guide, Release 15.10 259


Chapter 9 Table Data Development

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 Under Color Options, do the following:

a Select the Display alternate Result Set rows in color check box to display an alternate
row background color, and click the color box to select the alternate row color.
b In Insert selection color, click the color box to select the background color for
inserted data.
c In Update selection color, click the color box to select the background color for
updated data.
d In Delete selection color, click the color box to select the background color for
deleted data.
4 Under Editor Options, do the following:

a Select Show Row Numbers to show a numbered row column in the table data grid.

b In Filter Row Threshold Size, enter the number of table rows above which the Table
Data Editor presents the Data Filter dialog.
You must then specify filters to reduce the number of data rows that the Table Data
grid displays. The default is 150000. The maximum is 10000000 rows.
c In Transaction Row Threshold Size, enter the number of data rows to batch in a
single transaction.
This number is the threshold at which the batch UPDATE operation occurs. The
default is 500.
5 Under Copy and Paste Options, do the following:

a Select the Copy Column Names when Copying Rows check box if you want to
include column header labels when copying data to a file.
b In Copy Column Delimiter, select from the list the type of delimiter to use to
separate data when copying from the editor to a file, such as Microsoft EXCEL or
Notepad.
Supported delimiters are: Tab (default), Column, Semicolon, and Space.
You can also specify a single-character delimiter, instead of selecting from the list.
c In Paste Column Delimiter, select from the list the type of delimiter to use to
separate data when pasting rows into a table from a file.
Supported delimiters are: Tab (default), Column, Semicolon, and Space. You can
also specify a single-character delimiter, instead of selecting from the list.
6 Click Apply to apply your changes.

260 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

You can preview results in the Table Data Editor before you click OK.
7 After previewing, if you want to return to default values, click Restore Defaults.
8 Click OK to save your preference settings.

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,
rows in color and 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 Enter the number of table rows above which the Table Data
Threshold (rows) Editor 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 Enter the number of data rows to batch in a single COMMIT
(rows) 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:

Teradata Studio User Guide, Release 15.10 261


Chapter 9 Table Data Development

Option Description
Copy Column Names when Select the check box to include column header labels when
Copying Rows copying 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.

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 Under Color Options, do the following:

a Select the Display alternate Result Set rows in color check box to display an alternate
row background color, and click the color box to select the alternate row color.
b In Insert selection color, click the color box to select the background color for
inserted data.
c In Update selection color, click the color box to select the background color for
updated data.
d In Delete selection color, click the color box to select the background color for
deleted data.
4 Under Editor Options, do the following:

a Select Show Row Numbers to show a numbered row column in the table data grid.

b In Filter Row Threshold Size, enter the number of table rows above which the Table
Data Editor presents the Data Filter dialog.
You must then specify filters to reduce the number of data rows that the Table Data
grid displays. The default is 150000. The maximum is 10000000 rows.
c In Transaction Row Threshold Size, enter the number of data rows to batch in a
single transaction.

262 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

This number is the threshold at which the batch UPDATE operation occurs. The
default is 500.
5 Under Copy and Paste Options, do the following:

a Select the Copy Column Names when Copying Rows check box if you want to
include column header labels when copying data to a file.
b In Copy Column Delimiter, select from the list the type of delimiter to use to
separate data when copying from the editor to a file, such as Microsoft EXCEL or
Notepad.
Supported delimiters are: Tab (default), Column, Semicolon, and Space.
You can also specify a single-character delimiter, instead of selecting from the list.
c In Paste Column Delimiter, select from the list the type of delimiter to use to
separate data when pasting rows into a table from a file.
Supported delimiters are: Tab (default), Column, Semicolon, and Space. You can
also specify a single-character delimiter, instead of selecting from the list.
6 Click Apply to apply your changes.
You can preview results in the Table Data Editor before you click OK.
7 After previewing, if you want to return to default values, click Restore Defaults.
8 Click OK to save your preference settings.

Table Data Editing

Editing Table Data

The Table Data Editor enables you to update data in a database table by:
Inserting table data.
Deleting table data.
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.

Teradata Studio User Guide, Release 15.10 263


Chapter 9 Table Data Development

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
with equal to the value you enter.
Show Values Greater Type a numeric value to match against column data values that are
than greater 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:

Option Description
Show Values that Type a value to match against the initial characters of a data value in the
Start with selected 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
End with selected 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
Contains values in the selected column. The field supports alpha-numeric
characters. Do not use special characters or wildcards.

6 Click OK.

264 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

Deleting Table Rows

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.

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:

Teradata Studio User Guide, Release 15.10 265


Chapter 9 Table Data Development

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.

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.

266 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

Option Description
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.

Teradata Studio User Guide, Release 15.10 267


Chapter 9 Table Data Development

1 Make one or more edits in the Table Data Editor.


2 Click the SQL Preview icon in the toolbar.
See Toolbar for more information.
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.

268 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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
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.

Teradata Studio User Guide, Release 15.10 269


Chapter 9 Table Data Development

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.

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.

270 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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 15.10 271


Chapter 9 Table Data Development

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.
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.

272 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.
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.

Teradata Studio User Guide, Release 15.10 273


Chapter 9 Table Data Development

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.

274 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.
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.

Teradata Studio User Guide, Release 15.10 275


Chapter 9 Table Data Development

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.

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.

276 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.

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.

Teradata Studio User Guide, Release 15.10 277


Chapter 9 Table Data Development

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.

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.

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.

278 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.

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.

Teradata Studio User Guide, Release 15.10 279


Chapter 9 Table Data Development

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.

280 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.

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.
To open the XML Editor
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.

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

Teradata Studio User Guide, Release 15.10 281


Chapter 9 Table Data Development

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.

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.

282 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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.

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:

Teradata Studio User Guide, Release 15.10 283


Chapter 9 Table Data Development

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.

284 Teradata Studio User Guide, Release 15.10


Chapter 9 Table Data Development

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:

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:

Teradata Studio User Guide, Release 15.10 285


Chapter 9 Table Data Development

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.

Related Topics
Filtering with Data Filter, on page 240

286 Teradata Studio User Guide, Release 15.10


CHAPTER 10

Database and Table 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 Unified Data Architecture: Teradata Databases, Teradata Aster Databases, and
Hadoop. 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
About the Data Transfer Wizard The Data Transfer Wizard lets you select the source
type and destination type of a data transfer operation
About the Copy Object Wizard The Copy Object lets you copy tables and table data
from one Teradata system to another
About Smart Load Wizard Use Smart Load for ad-hoc data movement. You can
move data to external files from Teradata Databases
and Teradata Aster Databases. You also can move
data stored in external files back into a Teradata or
Aster system.
About the Load Data Wizard The Load Data Wizard loads data from an external
file in a file system to a Teradata or Aster database
table.
About the Export Data Wizard The Export Data Wizard exports data from a
Teradata or Aster table to an external file.
Working with the Transfer Hadoop Table to The Transfer Hadoop Table to Teradata Table Wizard
Teradata Table Wizard imports data from a Teradata Database table to
Hadoop.
Working with the Transfer Teradata Table to The Transfer Teradata Table to Hadoop Table Wizard
Hadoop Table Wizard exports data from Hadoop to a new Teradata table or
to an existing Teradata table.

Transferring Data From Tables


1 Open the Data Source Explorer by selecting Window > Show View > Data Source
Explorer.

Teradata Studio User Guide, Release 15.10 287


Chapter 10 Database and Table Data Transfer

2 Right-click Tables.
3 Select the Data Transfer command for the database type you are transferring data from:
Teradata Database
Teradata Aster Database
Hadoop

Importing and Exporting Table Data

1 Open the Data Source Explorer.


2 Navigate to the table object that is to be the source or destination for the data transfer.
3 Right-click the table object and select one of these options:

Option Description
Data > Export Data Exports data from the selected table.
Data > Load Data Imports data to the selected table.

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.

288 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

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

Teradata Studio User Guide, Release 15.10 289


Chapter 10 Database and Table Data Transfer

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:
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.

Transfer Data to Teradata Table


You can transfer data to a Teradata table (Destination Type = Teradata). Select one of the
following Source Type options:

290 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

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 Files Exports data from Aster to an external file in your system.

Transferring Data in Teradata and Hadoop Tables

Working with the Transfer Teradata Table to Hadoop Table Wizard


The Transfer Teradata Table to Hadoop Table wizard enables you to transfer data from a
Teradata table to a Hadoop table. The wizard launches from the Data Transfer Wizard when
you choose one of the options:
Option Description
Export to Hadoop Selects a Teradata table in Data Source Explorer to export to Hadoop when
you right-click the table and select Data > Export Data.
Load from Teradata Selects a Hadoop table in Data Source Explorer when you right-click a
table and select Data > Load Data.

The Data Transfer Wizard also displays when you drag and drop table objects inside the
Data Source Explorer or from Data Source Explorer to the Transfer View and Data Lab
View. If you use the drag and drop method, you are asked to view and assign a mapping for
the table column types and set the file type and delimiter if needed.

Teradata Studio User Guide, Release 15.10 291


Chapter 10 Database and Table Data Transfer

Working with the Transfer Hadoop Table to Teradata Table Wizard


The Transfer Hadoop Table to Teradata Table wizard enables you to transfer data from a
Hadoop table to a Teradata table. The wizard launches from the Data Transfer Wizard when
you choose one of these options:
Option Description
Export to Teradata Selects a Hadoop table in Data Source Explorer to export to Teradata
when you right-click the table and select Data > Export Data.
Load from Hadoop Selects a Teradata table in Data Source Explorer to load from Hadoop
when you right-click a table and select Data > Load Data.

The Data Transfer Wizard also displays when you drag and drop table objects inside the
Data Source Explorer or from Data Source Explorer to the Transfer View and Data Lab
View. If you use the drag and drop method, you are asked to view and assign a mapping for
the table column types and set the file type and delimiter if needed.

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 Load Data Wizard
(FastExport)*

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.

292 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Teradata Destination
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.

Teradata Studio User Guide, Release 15.10 293


Chapter 10 Database and Table Data 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.

294 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

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.

Teradata Studio User Guide, Release 15.10 295


Chapter 10 Database and Table Data Transfer

Source for Data Transfer


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 for Data Transfer
Provides the name of the Hadoop database to which the data is to be transferred. The
table you selected in the previous wizard screen displays as the Hadoop table name.
You can change this table selection if you choose.
If you selected to create a new Hadoop table, the Teradata source table name is used
as the default name.

296 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

File Specifications
Specifies the destination file type and the delimiter to use when transferring the data.
Columns To Transfer
Selects the columns in the Teradata table to transfer to the Hadoop table. By default
the column type of the Hadoop table is based on the column type of the source
Teradata 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. You can
also select all columns or no columns to transfer by clicking buttons at the bottom of
the list.
Transfer Job
Names the transfer job displayed at the bottom of the screen. You can change the job
name. The job name can be useful if the export is an operation that you might re-
execute in the future.
Reset All Values
Sets all the fields back to their default values.

When you click Finish, the wizard closes and 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.
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:

Teradata Studio User Guide, Release 15.10 297


Chapter 10 Database and Table Data Transfer

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
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.

298 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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 15.10 299


Chapter 10 Database and Table Data Transfer

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.

Related Topics
Aster Data Types, on page 332

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.

300 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Aster Definition
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.

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.

Teradata Studio User Guide, Release 15.10 301


Chapter 10 Database and Table Data Transfer

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.

302 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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). You can select Aster as the destination if you choose.
You can also transfer Hadoop 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
Wizard opens with Hadoop shown as the source and Aster as the destination.

Teradata Studio User Guide, Release 15.10 303


Chapter 10 Database and Table Data Transfer

Another option when transferring Hadoop data to Aster is to drag and drop a Hadoop table
object to an Aster table object in Data Source Explorer or Object Viewer. The Data Transfer
Wizard launches and opens the Column Specification dialog to allow you to specify which
columns to transfer to the Aster table.
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 SmartLoad 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 (Destination Type = Hadoop).
Transfer Source Option Opens
Teradata table Import from Teradata Transfer Teradata Table to Hadoop Table
Wizard

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.

304 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Destination of Data Transfer


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 of Data Transfer
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.
Teradata Connection Profile
Select the profile for the Teradata system that contains the data to be transferred.
Use the list in Teradata Connection Profile to make your selection.
Teradata Database
Select the database that contains the source table from the list.
Teradata Table
Select the source table that contains the data to transfer

Teradata Studio User Guide, Release 15.10 305


Chapter 10 Database and Table Data Transfer

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 for Data Transfer


Displays the name of the Teradata Database and table database.table that are the
source for the data transfer. This information cannot be edited.

306 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Destination for Data Transfer


Provides the name of the Hadoop database to which the data is to be transferred. The
table you selected in the previous wizard screen displays as the Hadoop table name.
You can change this table selection if you choose.
If you selected to create a new Hadoop table, the Teradata source table name is used
as the default name.
File Specifications
Specifies the destination file type and the delimiter to use when transferring the data.
Columns To Transfer
Selects the columns in the Teradata table to transfer to the Hadoop table. By default
the column type of the Hadoop table is based on the column type of the source
Teradata 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. You can
also select all columns or no columns to transfer by clicking buttons at the bottom of
the list.
Transfer Job
Names the transfer job displayed at the bottom of the screen. You can change the job
name. The job name can be useful if the export is an operation that you might re-
execute in the future.
Reset All Values
Sets all the fields back to their default values.

When you click Finish, the wizard closes and the settings are passed to the Transfer
Progress View where you can monitor the status of the transfer job.

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

Teradata Studio User Guide, Release 15.10 307


Chapter 10 Database and Table Data Transfer

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.
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.

308 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Icon Option Description


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.

Reexcute 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.

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.

Teradata Studio User Guide, Release 15.10 309


Chapter 10 Database and Table Data Transfer

Icon Option Description


Auto resize Resizes the current column.
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
Transferred filter.
Note Filters on the Note column. This is a "LIKE" filter.
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.

310 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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 cancelled.
Cancelled 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.

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.

Teradata Studio User Guide, Release 15.10 311


Chapter 10 Database and Table Data Transfer

Menu Description
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.
Icon Menu Description
Cancel Cancels the selected job in progress. The cancelled 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.

312 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

Import and Load External Data

About the Load Data Wizard

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 (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

Teradata Studio User Guide, Release 15.10 313


Chapter 10 Database and Table Data Transfer

drop-down lists to select the correct information.

Section Description
Data Import Use this section to specify the name of the file from which to import data and to
from External specify the server path to its location in the file system. To locate an existing file,
File click Browse and navigate the file system to select a file. 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.
Data Import Column Labels in First Row Specifies that the first row of the source file contains
Options the column labels to load as column headers in the
table.
Stop Loading If Max Error(s) Specify the maximum number of errors allowed
Occur before the wizard stops the Load operation.

314 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Section Description
Lock Table Select to lock the table during the load operation to
prevent any other Read/Write transactions on the
table. This feature is not available for Aster data
transfers.
Replace Existing Data Select to replace all existing data in the table with
the imported data from the file.
Import File You must specify how the source file delimits the data it contains. A delimiter is a
Delimiters character or sequence of characters that specify the boundaries of independent
and Encoding regions of data in plain text by distinguishing the beginning and end of the unit of
data, such as a field value. You can select commas, semicolons, spaces, tabs, fixed
widths, or vertical bars (|). You can optionally specify the character string delimiter
and type of file encoding used.
Data in Data contained in the external file displays at the bottom of the wizard screen. Table
External File data includes column name, column data type, and values in table rows.

Load Data Wizard


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 file to import.
File Type View a list of file types that can be imported like Delimited Text,
Excel, and Excel (97-2003).
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. The Delimited Text options
are:
Option Description
Column Delimiter Specify the column delimiter used in the input file.

Teradata Studio User Guide, Release 15.10 315


Chapter 10 Database and Table Data Transfer

Option Description
Character String Delimiter Specify the character string delimiter used in the input file.
Line Separator If you selected the Delimited Text file type, the File Options
section enables you to 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.
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.

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

1 Open the Data Transfer perspective by clicking on the Data Transfer tab.
2 Select a table object in the Data Source Explorer as the destination table for the data
load.
3 Right-click the table and select Data > Load Data.
If you do not have the Data Transfer perspective open, you are asked to switch to the
perspective.
4 In the Data Transfer Wizard, select External File as the Source Type.
5 Click Launch.
The Load Data Wizard opens.
6 In the Import Data into <filename>, 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.

316 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.
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 [Default] Select the Stop Loading If Max Error(s) Occur check box and specify the
maximum number of errors allowed before the Load operation stops.
10 [Optional] Select the Lock Table check box to lock the source and destination tables
during the Load operation.
11 [Optional] Select the Replace Existing Data check box to specify that data in the source
file replaces any existing data in the destination file.
12 In step 10, if you selected Delimited Text, complete the following File Options fields.

Teradata Studio User Guide, Release 15.10 317


Chapter 10 Database and Table Data Transfer

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 the Fixed
Width Columns field 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

318 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.
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.
JDBC Time escape format is: hh:mm:ss.
JDBC Timestamp escape format is: yyyy-mm-dd hh:mm:ss.ffffff.

About Smart Load Wizard

The Smart Load Wizard enables you to create Teradata and Aster tables derived from data
stored in an external file on your file system.

Teradata Studio User Guide, Release 15.10 319


Chapter 10 Database and Table Data Transfer

Import Data from External File


You can enter the path and name for the file to import or click Browse to find a file
on your file system. The Input File field is required. The default file type is delimited
text. If you choose a Microsoft EXCEL file type, you are shown options for files
with .xlsx and .xls extensions.
Table Column Option
The Column Labels in First Row check box lets you use the first row of data as the
column labels for the new table.
Drop Table If Max Errors
The Drop Table If Max Errors Occur check box lets you specify the maximum
number of errors required to drop a table.
Data Scan Option
When you import data stored in files with .txt and .csv extensions, you can perform a
partial scan of the file data during the import of that data to a Teradata table. This
option is not available for Microsoft EXCEL files.

320 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

File Data Options


If you selected the Delimited Text file type, the File Options section enables you to
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)
Controls
The action controls for the Smart Load Wizard are located at the bottom of the
screen and enable you to move back and forward among the Import File, Table
Column Data Types, and SQL Preview screens.

Opening the Smart Load Wizard


The Smart Load Wizard automatically opens when you select to transfer data to Teradata or
Aster from an external file in your file system. The following instructions assume that you
have the Data Transfer perspective open.
1 In Data Source Explorer select a Teradata or Aster Tables node:

Option Description
For Teradata Tables Right-click a Teradata Tables node and select Teradata - Data Transfer.
For Aster Tables Right-click an Aster Tables node and select Aster - Data Transfer.

2 In Source Type, select External File (Smart Load).


3 Click Launch.
The Import Data dialog of the Smart Load Wizard opens. For more information, see
Importing External File Data to Teradata and Importing External File Data to Aster

Importing External File Data to Teradata Tables


The following instructions assume that you have the Data Transfer perspective open.
1 Open the Data Source Explorer and navigate to a Tables node in a Teradata database.
2 Right-click the Tables folder and select Teradata > Data Transfer.
3 In the Data Transfer Wizard, select External File (SmartLoad) as the Source Type.
4 Click Launch.

Teradata Studio User Guide, Release 15.10 321


Chapter 10 Database and Table Data Transfer

5 In the Smart Load Wizard, type the directory path and name of the file that contains
data you want to import.
To find a file in your file system, click Browse, select the file, and click Open.
6 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.

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] 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 the Quick Scan check box to scan the
file partially when trying to derive a table from the imported data.
This option is only available for delimited text files, such as TXT and CSV files.

322 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.
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 If you selected Excel, in Import Worksheet, select the name of a worksheet in the
external file to import only that worksheet.
15 Click Next.
The Table Column Data Types screen displays.

Teradata Studio User Guide, Release 15.10 323


Chapter 10 Database and Table Data Transfer

16 In Table Name, type the name of the table to be derived from the loaded data.
17 In Primary Index, select one of the following options:

Option Description
No Primary Select if no primary index is to be created for the table. The Teradata primary
Index index is used to evenly distribute data among AMPs.
Not Unique Select if the Teradata primary index for the table is to be of the type NON-
UNIQUE. A non-unique primary index permits the insertion of duplicate field
values.
Unique Select if the Teradata primary index for the table is to be of the type UNIQUE. A
unique index must have a unique value in the corresponding fields of every row.

18 In Table Type, select whether the table is MULTISET or SET.


19 To edit the data types of a specific column, click (ellipses) in the column header.
For information about editing columns for a Teradata database, see Editing Teradata
Column Data Types.
20 Choose one of the following options:

324 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Option Description
Click Next Enables you to preview 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 will close.
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 Teradata Column Data Types


You can edit the data type for a Teradata table column prior to importing data in the Smart
Load Wizard.

1 In Type select the data type for the column you are editing.
For a description of data types listed, see Smart Load Type Options.
2 Select the Can contain nulls check box if the data in the column can include null values.
This action de-selects the Values must be unique check box if it is selected.
3 Select the Values must be unique check box if the data in the column must be unique
values.
This action deselects Can contain nulls.
4 If you selected SMALLINT as the data type, you can select the Distribute by Hash check
box 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.

Teradata Studio User Guide, Release 15.10 325


Chapter 10 Database and Table Data Transfer

5 Click OK.

Importing External File Data to Aster Tables


The following instructions assume that you have the Data Transfer perspective open.
1 Open the Data Transfer perspective by clicking the Data Transfer button in the toolbar.
2 Open the Data Source Explorer and navigate to a Tables node in a Teradata Aster
Database.
3 Right-click the Tables folder and select Aster > Data Transfer.
4 In the Data Transfer Wizard, select External File as the Source Type.
5 Click Launch.
The Load Data Wizard launches.
6 In Import Data, type the directory path and name of the input 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.
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 [Default] Select the Drop Table If Max Error(s) Occur check box and specify the
maximum number of errors allowed before the Load operation stops.
10 [Optional] Select the Quick Scan check box to scan the file partially when trying to
derive a table from the imported data.
This option is only available for delimited text files, such as TXT and CSV files.
11 In step 10, if you selected Delimited Text, complete the following File Options fields.

326 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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 the Fixed
Width Columns field 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

Teradata Studio User Guide, Release 15.10 327


Chapter 10 Database and Table Data Transfer

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.
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.
12 In step 10, if you selected Excel or Excel 97-2003, complete the following File
Options fields.
a [Optional] In Import Worksheet, select an individual worksheet in the input Excel
file to import.
b In Start Loading At Row Number, type the table row number at which you want the
wizard to start loading data.
13 Click Next.
The Table Column Data Types screen displays.

328 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

14 In Table Column Data Types specify the name of the table to be derived from the
loaded data.
15 In Table Type select one of the following options:

Option Description
DIMENSION Describes the information in fact tables and contains attributes used for
grouping, constraining, and reporting fact table data.
FACT Contains numeric measurements such as aggregates, averages, and summations.
Fact tables are surrounded by dimension tables which analyze or dimension the
data in a fact table.

16 You must decide which column to distribute by hash.


To designate distribution by hash and to edit the data types of a specific column, click
(ellipses) in the column header.
For information about editing columns for an Aster database, see Editing Aster Column
Data Types.
17 Choose one of the following options:

Teradata Studio User Guide, Release 15.10 329


Chapter 10 Database and Table Data Transfer

Option Description
Click Next Enables you to preview the SQL 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 will close. 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 Aster Column Data Types


You can edit the data type for an Aster table column prior to importing data in the Smart
Load Wizard.

1 In Type select the Aster data type for the column you are editing.
For a list of data types supported in Smart Load Wizard, see Aster Data Types.
2 Select the Can contain nulls check box if the data in the column can include null values.
This action de-selects the Values must be unique check box if it is selected.
3 Select the Values must be unique check box if the data in the column must be unique
values.
This action deselects Can contain nulls.
4 Select the Distribute by Hash check box if you want to specify a distribution key column.
Using DISTRIBUTE BY HASH with a distribution key is mandatory for fact tables and
optional for dimension tables. You must select at least one column in the table to
distribute by hash.
5 Click OK.

330 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Smart Load Type Options


The following data types are supported in the Smart Load Wizard and available in the Type
field.
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 Large character string
OBJECT
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
SECOND seconds
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 An interval defining a period of time in years and months
MONTH
JSON (JavaScript Object Notation) text-based, data interchange format
used in web applications to transmit data

Teradata Studio User Guide, Release 15.10 331


Chapter 10 Database and Table Data Transfer

Teradata Data Type Description


NUMERIC Numeric data such as integers, real numbers, and floating-point
numbers.
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

Aster Data Types

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.
IP4 IP address

332 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Aster Option Description


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

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.

Teradata Studio User Guide, Release 15.10 333


Chapter 10 Database and Table Data Transfer

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 .cvs file, or to 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 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.

334 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

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.

Related Topics
Copying Table Data Between Teradata Databases, on page 337
Dropping Objects on Transfer View, on page 337

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.

Teradata Studio User Guide, Release 15.10 335


Chapter 10 Database and Table Data Transfer

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.

336 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

21 Click Finish to run the transfer job.


The Copy Object Wizard prompts you that the object created successfully or failed.
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.

Teradata Studio User Guide, Release 15.10 337


Chapter 10 Database and Table Data Transfer

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.
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,
existing table and 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.

338 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

Source Database
The source information includes the names of the Connection Profile, Database, and
Table from which the data is copied.

Teradata Studio User Guide, Release 15.10 339


Chapter 10 Database and Table Data Transfer

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.
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

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

340 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

Related Topics
About Copying Teradata Objects, on page 335

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.

Teradata Studio User Guide, Release 15.10 341


Chapter 10 Database and Table Data Transfer

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.

342 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

Teradata Studio User Guide, Release 15.10 343


Chapter 10 Database and Table Data Transfer

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:
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
destination table copied 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.

Related Topics
Column Data Type, on page 344

Column Data Type


Data Type Description
BINARY LARGE OBJECT Large binary string of raw bytes
BYTE Fixed length binary string
CHARACTER Fixed length character string
CHARACTER LARGE OBJECT Large character string
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

344 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

Data Type Description


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
SECOND seconds
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 d
seconds
JSON (JavaScript Object Notation) text-based, data interchange format
used in web applications to transmit data
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
TIME ZONE) is available only for Teradata 13 and later.)
SMALLINT 16-bit binary integer
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

Teradata Studio User Guide, Release 15.10 345


Chapter 10 Database and Table Data Transfer

Data Type Description


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

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.

346 Teradata Studio User Guide, Release 15.10


Chapter 10 Database and Table Data Transfer

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.

Teradata Studio User Guide, Release 15.10 347


Chapter 10 Database and Table Data Transfer

348 Teradata Studio User Guide, Release 15.10


CHAPTER 11

Troubleshooting

Troubleshooting Studio

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.

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 15.10 349


Chapter 11 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.

Parameter Tuning

Increasing Memory settings (OutOfMemory Error)


Memory settings can be specified through the Java Virtual Machine arguments option (-
vmargs) when launching Teradata Studio. A TeradataStudio.ini file exists that contains
VM argument settings, such as -Xms256m, -Xmx256m, and -XX:MaxPermSize=256m (setting
all three arguments to 256 megabytes). The TeradataStudio.ini file is located on
Windows and Linux systems in the /TeradataStudio directory. On Mac OS X systems, it
is located in the application package > Contents > MacOS directory.

350 Teradata Studio User Guide, Release 15.10

S-ar putea să vă placă și