Questions tagged [teradatasql]

The Teradata SQL Driver for Python (or related drivers). For Teradata (Vantage) database questions, use the [teradata] tag instead.

The Teradata SQL Driver for Python is a DBAPI Driver that enables Python applications to connect to the Teradata Database. The Teradata SQL Driver for Python implements the PEP-249 Python Database API Specification 2.0.

It is available from PyPI or Teradata's public download site and is used by the Teradata Python Package (teradataml) and the Teradata SQL Driver Dialect for SQLAlchemy (teradatasqlalchemy) to connect to a Teradata DBMS, aka Teradata Vantage SQL Engine. This driver is also leveraged by the Vantage Modules for Jupyter and is closely related to the Teradata SQL Drivers for R and Node.js.

272 questions
0
votes
0 answers

regexp_replace in teradata for date value

I am using regexp_replace function in Teradata but encounters the below issues I am looking to replace datevalue to YYYYMMDD. Below is the query i have used select RegExp_Replace('20230320',[0-9]{8},'YYYYMMDD') error I get is " expected something…
PK39565
  • 11
  • 3
0
votes
0 answers

UpdatTeradata [3706] syntax error: expecting something between the word 'case' and the 'when' keyword

Want to create age buckets in Teradata 16.20.0.2; Database version: Teradata 16.20.53.56; Provider Version: Teradata.Net 16.20.1.0. Code throwing syntax error. Code: select ptnt_bth_dt, case  when ( cast(CURRENT_DATE as date) - cast(ptnt_bth_dt…
Madhuri
  • 1
  • 3
0
votes
0 answers

SQL Teradata: How to pivot columns values into columns?

I'm trying to pivot unique column values into columns and I can't figure out how to do it. I have the following table: ID Model 1 100 1 100 1 200 1 200 1 200 2 100 2 100 2 100 2 300 2 …
0
votes
0 answers

Teradata- I am trying to separate multiple values in a column which are comma delimited into different rows

I have table in teradata which has muliltple values in a column which are comma delimited. I am trying to separate the values into different rows Pk Column 1 HK1, HK2, HK3 2 HK2, HK3, HK4 3 HK2, HK8, HK7 4 HK9 My output should look…
0
votes
1 answer

Regex Teradata Question to identify amount in the fields

ID COLUMN_1 COLUMN_2 COLUMN_3 1 FEE $8 NO FEE UNPAID FEE $18. 2 UNPAID FEE $12 ACCOUNT_FEE $12. 3 OD FEE 2 * $4 $8 FEE $9 ACCOUNT_FEE $8. I have a table like the above and I need to separate different fees that are in different…
0
votes
0 answers

Is there any SQL query to check if we are using a table or a column in any of our workflows (Sources or lookup)?

I need to check impact of few of the columns/tables as some of the workflows are about to be decommissioned. One way of finding is to manually open each session of each of the workflows and check in lookups/source queries. So is there any easier way…
0
votes
0 answers

Add/transfer CommentString to columns in TeraData using the CREATE TABLE AS SELECT statement

I want to add desciptions to my columns that I can query in Teradata. I recently came aware of the existence of the CommentString Column in TeraData DBC.Columns. I want to use it to add (short) descriptions to columns. Since I have a lot of code…
Ricoter
  • 665
  • 5
  • 17
0
votes
2 answers

Teradata Query to fetch email id from string data

Input: Data storing in column is string within that email ids are present. Need to fetch email ids.There is no fixed pattern. Example : Field 1 test – test12 – test@gmail.com - test1@gmail.com abc - abc@gmail.com - abc1@gmail.com -…
Sak
  • 61
  • 6
0
votes
1 answer

Select average if day occured and does not find a date from column

I have a table of exchange rates that contain a day and a value column, where the first one is the day of the exchange rate and the other has the value of that day. Then I have another table which has amount value of a KPI in euros, so I need to…
0
votes
0 answers

Add space after 4th character in Teradata SQL

How to add a space after the 4th char in Teradata SQL? i.e., SEL column1 FROM table 1 output = 12345678. I'm looking for output to be: 1234 5678 sel substring(column1, 4,1) ?????
0
votes
0 answers

Prevent a control table from getting new dates for the same day - Teradata SQL

I have a proc that loads a new date and time into a control table each day. Sometimes the proc may get ran again but I want to prevent that control table from getting a new date entry again if we are in the same day. What SQL code can I use to…
0
votes
1 answer

Teradatasql python module not throwing duplicate error

I have installed teradatasql python module recently.When I am doing batch insert into table it is not throwing duplicate error in the script, Else it is skipping that insert statement. Table has first column as UNIQUE in teradata table. But I want…
0
votes
1 answer

Teradata SQL selecting successive batch of rows

I have 300000 entries in my db and am trying to access entry 50000-100000 (to 50000 total). My query is as follows: query = 'SELECT TOP 50000* FROM database ORDER BY col_name QUALIFY ROW_NUMBER() BETWEEN 50000 and 100000' I only found the BETWEEN…
Kate S.D.
  • 105
  • 10
0
votes
1 answer

How to create a Teradata table by copying and modifying another Table?

I am trying to create a new Teradata table by copying another table, but also need to add one new column, based on a condition of another column from the old table while copying, can you help me on the code? create Table new_table as (select…
JMJ
  • 11
  • 2
0
votes
1 answer

How to use regexp_instr in Teradata such that start position of the search start at the end? Unlike INSTR its not taking -1 as position argument

How to use regexp_instr in Teradata such that start position of the search start at the end? Unlike INSTR its not taking -1 as position argument?I was trying to get the occurrence of a pattern from the end of a string. Unlike INSTR its not taking -1…
Souvik
  • 1
  • 1