Questions tagged [teradata]

Teradata is a Relational Database Management System (RDBMS), capable of supporting many concurrent users from various client platforms. Teradata is compatible with the ANSI standard and built completely on parallel architecture.

Filter by
Sorted by
Tagged with
1 vote
2 answers
45 views

Teradata SQL conditional joining between dates

I have two records that look like this in TABLE1: KEY RECORD_START_TS RECORD_END_TS 1 2023-08-06 00:00:00 9999-12-31 00:00:00 2 2022-11-27 00:00:00 2023-08-05 23:59:59 I need to execute a ...
Larry Burholme's user avatar
0 votes
0 answers
46 views

Duration gaps and duration gaps in terms of Months

I'm trying an SQL query in Teradata to find the gaps and group the duration. I have a dataset with duration gap, I’m trying to find the gap and group them. When I use the min and max dates shows ...
Sunny_J's user avatar
0 votes
2 answers
32 views

Teradata Volatile table performance

I have an issue with creating volatile tables that suddenly appeared overnight. The source of the volatile table is a query that runs independently in .4 milliseconds and produces 74 records. When I ...
UncleJasper75's user avatar
0 votes
1 answer
24 views

Replicate data by number of months - SQL Teradata

I need help from the community, I have a table that has the following information: Date Number of Months Value 2019-01-01 1 7 2019-01-01 3 5 2019-02-01 2 9 Depending on the number of months, I ...
Lucca F's user avatar
  • 23
-1 votes
0 answers
31 views

Teradata error: "The transaction exceeded the maximum number of rowhash locks allowed" [closed]

ABINITIO(DB15038): Teradata ODBC Error ABINITIO(DB15038): SQLCODE: -9128 ABINITIO(DB15038): SQLSTATE: HY000 ABINITIO(DB15038): MESSAGE: [Teradata][ODBC Teradata Driver][Teradata Database](-9128)...
Nagaraju N's user avatar
-2 votes
2 answers
36 views

Having count(distinct x) not returning correct results - Teradata SQL

I'm working in Teradata, and my data looks like this: Image of data my query is: select id, type from table1 where id in (100, 101) group by 1,2 having count(distinct type) > 1 but its returning ...
user13948791's user avatar
0 votes
0 answers
22 views

Teradata with SQLAlchemy cannot open shared object file teradatasql.so

I'm trying to connect to a Teradata database with SQLAlchemy using: $ pip list | grep -i teradatasql teradatasql 20.0.0.0 teradatasqlalchemy 17.20.0.0 The first time I try to ...
Joaquín L. Robles's user avatar
0 votes
1 answer
42 views

How to fix TPT script error? 'MSG='[Microsoft][SQL Server Native Client 11.0]String data, right truncation' '

I am using Teradata Parallel Transport to select and insert data from tables in a SQL Server to identical tables in a Teradata database. I have done this before successfully but this is the first time ...
DirtyDataDoneDirtCheap's user avatar
0 votes
1 answer
43 views

SAS is not properly updating

I have a SAS script that copies data from a view, and saves them to a table. This includes a column that gives the date for when the view was last run (current_date AS sist_oppdatert). I expected that ...
Berit Larsen's user avatar
0 votes
1 answer
71 views

How to take the preceding Value based on condition in teradata sql

I meet some issues when trying to get the preceding GRADE based on The BEGINING_DATE (when it change ) Here is my data : ID GRADE BEGINNING_DATE ENDING_DATE 1 12 14/06/2021 14/06/2022 1 12 14/06/...
Arthur_75's user avatar
0 votes
0 answers
23 views

Standard character set for auto created tables using Kafka and JDBC Sink Connector

We are using Kafka and Confluent JDBC Sink Connector to export data from Kafka topics to a Teradata database. Unfortunately I have an issue with the Auto Create/Evolve feature as this generates tables ...
spcial's user avatar
  • 1,529
0 votes
2 answers
59 views

Assign the row sequence for each customer from the row where amount is greater than zero

I want to assign the row sequence for each customer from the row where amount is greater than zero. sequencing always should start from the row where amount is zero. Here is sample data with expected ...
Ramesh's user avatar
  • 5
0 votes
1 answer
33 views

How to concatenate results when using PIVOT in Teradata Studio

I have a table with one or more rows for each value of the ID column. Now I want to pivot this table and aggregate the resulting values of the value columns by concatenation in SQL. Below is an ...
degeso's user avatar
  • 161
0 votes
0 answers
25 views

Date Time Function - Teradata

I am trying to convert this time '2012-6-17 09:50:3.000000' I want to remove the additional zeros from here , this date is US time zone I want to convert it to local time zone. I tried using datepart(...
SHAGUFTA TABREEN's user avatar
-1 votes
1 answer
43 views

Separate one column in multiple column in teradata studio

I have a table with one column. Every row is like this: Name|surname|Address|date But I want separate this column in 4 columns, one for each variable. How Can I make it in terastudio with sql?? I ...
Luca's user avatar
  • 1
-2 votes
1 answer
40 views

Does Snowflake have an equivalent to the TeraData nPath?

In Teradata I can get rid of noise rows and just pick the first and last dates of a series of rows with nPath. I don't see a Snowflake function with the same name, but I'm thinking there might be one ...
Patrick's user avatar
0 votes
0 answers
24 views

Combine rows in Teradata SQL if a id field appears more than once

I'm trying to go from the first picture to the second picture. Basically, if the Concatenated field appears more than once do to there being 2 or more reps attached to the identifier, show all the ...
Charles's user avatar
0 votes
0 answers
24 views

How do you access Teradata datalab in Python

I can access Teradata datalab (Sandbox) in SAS. Is it possible to access it through SAS?
fae4life99's user avatar
0 votes
0 answers
78 views

Need help incorporating SQL in Python loop with global variables in python being cast into the SQL [duplicate]

I want to automate the query below so that the start and end date can be entered manually but then the query can run on a loop for any given number of months on a monthly basis based on the initial ...
dataenthu's user avatar
-1 votes
1 answer
31 views

I want to insert values for 3 columns in a teradata view .But it gives errors Syntax looks correct but error is not related to syntax

INSERT INTO sample_db.sample_table(CONFRM_CD_VAL_TXT,CONFRM_CDSET_NM,SRC_CD_VAL_TXT,CHNL_SRC_CD) values ("CAD","CLM_MEDIA_TY_CD","CAD","ESI" ); Here I get a ...
Faisal's user avatar
  • 57
1 vote
2 answers
56 views

TERADATA SQL: RANDOM SAMPLE AVOID BREAKING GROUPS

I have c. 13m records that look something like; Cust_ID Order 123 a1 123 a1 123 a2 456 a2 789 b2 789 b3 I want to take a sample of say 2m but want to avoid breaking up any cusotmer records (i....
TheJammyHamster's user avatar
0 votes
1 answer
50 views

How to get the next value in a dynamic range?

I wish to get the next value in a dynamic range. Between all values existing up until point X (determined by column TimeDate) I want to get the next largest ValueDate if it exists. The lookup could be ...
Castro's user avatar
  • 3
0 votes
0 answers
45 views

Multiple partition in Pyspark creates multiple sessions in Teradata while writing a Dataframe, causing deadlock (Via JDBC data source)

Spark dataframe with multiple partition (4) creates multiple sessions in teradata when I perform write operation due to which causing the deadlock. May i know please, is it possible to perform write ...
Keerthi's user avatar
0 votes
0 answers
60 views

Spark (pyspark) overwrite the table in teradata using JDBC with string column length (varchar(255)). It is not allowing more than 255 string length

When I write ("overwrite") spark dataframe into teradata via JDBC, the string fields are created with only 255 characters length even though the source has more than that. I request someone ...
Keerthi's user avatar
0 votes
1 answer
54 views

How to execute, Startup Sql for teradata in Pyspark using JDBC

I have set RUNSTARTUP=ON in teradata JDBC connection parameter to execute startup sql. I am not aware where/how to specify startup sql to write spark dataframe in teradata. I would like to execute ...
Keerthi's user avatar
0 votes
0 answers
64 views

Defining a variable used later in the SELECT Teradata query

I have a problem with defining a variable that I will later refer to in the SQL query. I do it on Teradata. I have specific code where a given column must include these values. var_1 = ('x1', 'x2', '...
Konrad Lubelski's user avatar
0 votes
0 answers
58 views

Teradata optimizer generating an IS NOT NULL check for NOT NULL columns

This is less of a problem and more of a question. I wish to understand why the optimizer creates a NOT(COLUMN_NAME IS NULL) condition for a column that is NOT NULL. I have checked the query on two ...
Castro's user avatar
  • 3
1 vote
1 answer
33 views

Creating Session ID Buckets

I am trying to create a session_id column that groups a bunch of sessions into buckets based on if there has been a 30 minute gap... ID Session_TM 001 00:15:12 001 00:17:17 001 01:00:00 001 01:55:...
TheJammyHamster's user avatar
0 votes
0 answers
63 views

Teradata PDE state: DOWN/HARDSTOP

I have ran /etc/init.d/tpa start but it says Teradata Database Initiator service failed with 4 exit code I have ran /var/log/messages but it says bash: /var/log/messages: Permission denied I need some ...
JohnnyDevv's user avatar
-1 votes
1 answer
39 views

Updating the table nulls with values from another table with a priority rank

Please help me writing an Teardata SQL query to to update NULL values in Table1 with Store from Table 2 , however it should be in order as per ran The final result as per the expected output in the ...
sachin's user avatar
  • 1
-2 votes
1 answer
56 views

Getting NULL VALUES FROM THIRD TABLE WHEN JOINED WITH OTHER TWO TABLES

I am trying to join a third table "TERADATA"."PRD_DWH_VIEW_LMT"."ZZMMSPECPRO_V" with the other two tables in Snowflake. However, I am getting NULL values when all three ...
Kartik's user avatar
  • 15
0 votes
2 answers
57 views

How to automate this part of the sql code?

I help my team do monthly reporting. For the below case when statement, can anyone kindly show me how to automate this part of the code instead of writing an additional line of the case when statement ...
Kath's user avatar
  • 1
0 votes
0 answers
27 views

teradata query to analyse a particular DOB and convert it to max date of that particular month

I want to build a teradata query that will analyse the DOB field of a table and use case statement to update accordingly. It will keep the month and year fields as it is and change the date as per ...
Niladri's user avatar
  • 29
1 vote
1 answer
41 views

SpringBatch Teradata DatabaseType support

I'm using SpringBatch 5 with Teradata db , I tried to create a job repository to add a datasource but i get an exception about org.springframework.batch.support.DatabaseType : Failed to instantiate [...
Yaz's user avatar
  • 503
0 votes
2 answers
246 views

ERROR [HY000] [Teradata][ODBC] (10001) General error: invalid vector subscript ALTER Command Failed

While trying to add a column in Teradata with the following query ALTER TABLE DB121.CUSTOMER_OPTION ADD (OPTION_CODE VARCHAR(4000) CHARACTER SET LATIN NOT CASESPECIFIC) I get the following error &...
Harsha's user avatar
  • 1
0 votes
0 answers
49 views

What is difference between column title vs column name

I studying Teradata DBMS, and Teradata can be has column title when create table like this CREATE SET TABLE HR.Employees ( GlobalID INTEGER title 'Test title', FirstName VARCHAR(30), LastName ...
DannyPoet's user avatar
0 votes
0 answers
40 views

Does the order in the WHERE statement mattter?

I have read that the order in the WHERE statement does not matter, but I believe it might or I'm doing something wrong. I have about 50k records. I exported everything to Excel and filtered the report ...
blue's user avatar
  • 7
0 votes
1 answer
52 views

Why is pandas.to_sql trying to create a table even though I specified to append if_exists?

Here's my code. Simply trying to append a dataframe to a Teradata table. import pandas as pd from sqlalchemy import create_engine import sqlalchemy_teradata user = username pasw = password host = ...
WannabeDev's user avatar
0 votes
0 answers
46 views

Is there a function in Python's Logging to just get the message and not the codes?

I have a Python script that uses PYODBC to connect to a Teradata database and passes some SQL to it to perform an ETL. I have the logging formatted to a basicConfig and would like to pass the ...
WannabeDev's user avatar
0 votes
0 answers
39 views

Teradata and SQL Server : how to get hierarchy

In Teradata/SQL Server, how to get by SQL/BTEQ the hierarchical top parent? Head teacher is minimum id among all the teacher of the student. if student 10 has 3 teachers 1,8,9; teacher (id) 8 & 9 ...
user3016635's user avatar
0 votes
1 answer
74 views

How to format date in Teradata where some fields only have zero?

I have a field named myfakedate [Decimal, 7,0)] where the field returns values as (ex. 20201205, 20230416, 20170509). My goal is to return them as 2020-12-05, 2023-04-16 & 2017-05-09. There are a ...
blue's user avatar
  • 7
0 votes
1 answer
35 views

How to filter for first occurrence of record?

I have a Daily table in Teradata. On any given month, we can have about 500 clients (about 20 added a month) that meet the criteria below. I built a query to pull data the 1st occurrence where the ...
blue's user avatar
  • 7
0 votes
0 answers
32 views

Teradata - Insert statement works for me but not colleague - Invalid timestamp

I have a SQL script I use to import data using Teradata SQL Assistant. It works for me but not for my colleague: they get "Error importing batch records 1 - 20: [6760] Invalid timestamp." I ...
MisterM2402's user avatar
0 votes
0 answers
24 views

Teradata SQL: Problem adding multiple rows into newly created table using CREATE MULTISET TABLE

Here is my query: DROP TABLE table_name -- Create the multiset table to store product line owner information CREATE MULTISET TABLE table_name ( Product VARCHAR(100), Owner VARCHAR(100), ...
user21077255's user avatar
0 votes
0 answers
27 views

Why does Teradata give different total estimated run times in the 'explain' results for the exact same query?

I ran explain (F6) on a query yesterday. The estimated time was a few minutes and it took 6 minutes to run. I pulled up the exact same query today and ran explain, but it produced an estimated time of ...
Catlover's user avatar
  • 379
0 votes
0 answers
19 views

Top or Sample N of subgroups in Teradata in a large data set ("No Spool Space" error)

I've tried several routes to getting the 10 records from each subset of a large dataset and the best I can do is querying each subgroup explicitly in the query. My first attempt from the (Teradata ...
n8.'s user avatar
  • 1,736
0 votes
0 answers
28 views

is it possible to use CTE expression in teradata TPT script?

I have a complex teradata query that runs in a TPT script using Export operator ans selectStmt attribute. When I refactored the query using CTE I get : TPT10508: RDBMS error 3706: Syntax error: ...
firsni's user avatar
  • 866
0 votes
0 answers
19 views

Shred multiple JSON arrays using JSON_TABLE in Terdata

I have to shred a JSON using Teradata JSON functions. Suppose I hava JSON like { "products":[{"category":"car","name":"toyota"}, {&...
ѕтƒ's user avatar
  • 3,557
0 votes
1 answer
46 views

Case condition in Sql teradata [closed]

Below is the table data: Id. Race 101 White 101 Hispanic 101 Black 101 Not provided 202 Hispanic 202 Black 202 Asian 303 Not provided 303 ...
Maddy's user avatar
  • 9
0 votes
1 answer
22 views

How to union two incomplete tables in teradata

I need to union two incomplete tables in Teradata. I know there is a function analogous to union in Teradata that does this. first table: id name 1 John 2 NULL 3 Nick 4 NULL second table: id name ...
Michael's user avatar

1
2 3 4 5
112