Teradata Columnar Solution: Advantages and Disadvantages

arch3

How Advanced Is The Teradata Columnar Solution? A Column Store is defined by three distinct properties: Why Is The Teradata Solution Great Even Though It Does Not Offer Columnar Processing? Assuming a standard query, a date range selection is frequently made with a WHERE condition imposing a date restriction. However, only a portion of the …

Read more

Comparing the Architecture of Amazon Redshift and Teradata: Similarities and Differences

arch2

This post will contrast the architecture of two widely-used database systems. The similarities between Teradata and Amazon Redshift are notable, as much of your knowledge about Teradata can be applied to Amazon Redshift. Although Amazon Redshift stores data in columns permanently, the similarities remain significant. Teradata can store data in columns, though it was not …

Read more

Understanding Teradata Load Isolation

design4

Isolation Levels and their Impact on Performance & Concurrency Isolation is a crucial factor in determining the visibility of transaction integrity to database users. This property guarantees that concurrently executed transactions produce identical results to those executed sequentially. Nonetheless, relinquishing this requirement can enhance transaction concurrency, improving performance. However, this also implies accepting inconsistent outcomes. …

Read more

Building a Teradata Data Warehouse: Considerations for ETL Process, SQL Queries, and Physical Data Model

design4

This post aims to compile all crucial aspects to be considered while constructing a Teradata Data Warehouse, including the ETL process and SQL queries. This list is just the beginning, and I anticipate receiving valuable feedback from my readers to expand it in the future. Initially, I have provided a few concepts, but I intend …

Read more

Teradata Access Paths: 8 Essential Ones to Know

tune1

The optimizer has various access paths to consider when creating the execution plan, each with unique advantages and disadvantages. This article will introduce the 8 most essential access paths. The lack of a hash index may surprise you; however, Teradata has entirely substituted it with the single-table join index and discourages its utilization in the …

Read more

Maximizing Performance with Multiple Teradata Sessions

tune2

Teradata Sessions explained in a few Sentences Example 1: Multiple Sessions which do not improve performance The graph shows that all four transactions (T1, T2, T3, T4) are concurrently active on all AMPs. Even for a single-row lookup, these transactions necessitate accessing all AMPs. None of the transactions use a single rowhash for access, resulting …

Read more

Teradata Table Design Checklist: Primary Index, Character Set, and Data Type Considerations

tune3

Teradata Table Design Checklist As creating tables is a frequent task, I deemed it necessary to provide a checklist. 1. Primary Index Or NOPI Table? The Primary Index serves multiple purposes, primarily functioning as the primary access path to the data and being optimized for an even distribution of rows. However, designing a table without …

Read more

Achieve Incredible Teradata Join Performance

tune2

Executive summaryGUEST POST BY ARTEMIY KOZYR Today I shed some light on how Data Warehousing lies at the core of Retail Banking operations. We will see the actual case of vital marketing process malfunction and dive deep under the surface level to comprehend data alchemy technical issues. You will learn how to approach such issues, …

Read more

Optimizing Teradata Requests with Group-AMP Operations for Improved Performance

tune4

All-AMP and single-AMP operations are well-understood. All-AMP retrieval typically involves full table scans, including NUSI sub-table scans. On the other hand, single-AMP retrieval typically involves indexed access, such as UPI and NUPI. Group-AMP operations optimize requests by minimizing the number of active AMPs. These operations fall between single-AMP and all-AMP operations. The Optimizer employs group-AMP …

Read more

Learn Teradata Indexing Techniques in this 2-Hour Video Course

tune2

Introduction

Teradata SQL lacks a built-in function to determine the ASCII code of a character. But fear not, for there exists a query workaround to this dilemma. This blog post will guide you through the process of using a straightforward SQL query in Teradata to find the ASCII code of a character.

The solution is as follows:

We use the Teradata SQL function CHAR2HEXINT to obtain a hexadecimal value for a character. Our objective is to convert this hexadecimal value to its decimal counterpart, which signifies the character’s ASCII code.

This SQL query accomplishes the task.

SELECT
CASE SUBSTRING(CHAR2HEXINT('B') FROM 3 FOR 1)
WHEN '0' THEN 0
WHEN '1' THEN 1
WHEN '2' THEN 2
WHEN '3' THEN 3
WHEN '4' THEN 4
WHEN '5' THEN 5
WHEN '6' THEN 6
WHEN '7' THEN 7
WHEN '8' THEN 8
WHEN '9' THEN 9
WHEN 'A' THEN 10
WHEN 'B' THEN 11
WHEN 'C' THEN 12
WHEN 'D' THEN 13
WHEN 'E' THEN 14
WHEN 'F' THEN 15
END * 16 +
CASE SUBSTRING(CHAR2HEXINT('B') FROM 4 FOR 1)
WHEN '0' THEN 0
WHEN '1' THEN 1
WHEN '2' THEN 2
WHEN '3' THEN 3
WHEN '4' THEN 4
WHEN '5' THEN 5
WHEN '6' THEN 6
WHEN '7' THEN 7
WHEN '8' THEN 8
WHEN '9' THEN 9
WHEN 'A' THEN 10
WHEN 'B' THEN 11
WHEN 'C' THEN 12
WHEN 'D' THEN 13
WHEN 'E' THEN 14
WHEN 'F' THEN 15
END

Using a CASE statement, the query extracts two hexadecimal digits with the SUBSTRING function and converts them to decimal values. It then calculates the character’s ASCII code by multiplying the first digit’s decimal value by 16 and adding the second digit’s decimal value.

Conclusion

Teradata SQL lacks a dedicated feature for determining the ASCII code of a given character. However, this blog post offers a straightforward and efficient workaround for this issue. By utilizing the CHAR2HEXINT function and performing basic arithmetic operations, you can effectively determine the ASCII code of any character within your Teradata SQL queries.

DWHPro

Expert network for enterprise data platforms. Senior consultants, project teams built for your challenge — across Teradata, Snowflake, Databricks, and more.

📍Vienna, Austria & Jacksonville, Florida

Quick Links
Services Team Teradata Book Blog Contact Us
Connect
LinkedIn → [email protected]
Newsletter

Join 4,000+ data professionals.
Weekly insights on Teradata, Snowflake & data architecture.