546 questions
Advice
0
votes
3
replies
65
views
Procedure to show percentage of nulls in TERADATA SQL ASSISTANT
I'm working in Teradata SQL Assistant and I need to create a stored procedure that, given a table name, returns the percentage of NULL values for each column in that table.
Right now, I generate the ...
0
votes
2
answers
66
views
Group count on derived table in Teradata
I'm trying to create a frequency count table on a derived healthcare table of member age in months when receiving a first medical diagnosis (datediff(month,d.birthdate,d.min_claimdate)).
My cleaned up ...
0
votes
1
answer
147
views
Pass table columns as arguments into Teradata SQL stored procedure
For context, I am very new to Teradata SQL and am currently trying to understand how to build out user defined functions (UDF) and procedures (UDP), in SQL form only, though am having some ...
0
votes
0
answers
45
views
I want to figure out how to count the number of months consecutively in a query
I am trying to extract data in relation to customer savings on Teradata. So I want to figure out how many months in a row a customer has saved money in 2024 and to display that as a number. I.e if a ...
0
votes
0
answers
105
views
Distinct product grouping based on a set of columns with duplicate rows
THIS IS THE CURRENT STATE DATA:
THIS IS THE DESIRED FUTURE STATE:
Basically, the requirement is that, when the txn_type="dept" and txn_grp="store", from that txndate, within 183 ...
0
votes
1
answer
91
views
Repeat Date in Teradata Studio vs. SQL Data Assistant
I am new at my job and we use Teradata. I am using Teradata Studio, and one of our longer Procedures starts with this statement:
SELECT ...
0
votes
0
answers
39
views
Teradata SQL - table has a list of activation and deactivation activity dates on individual lines, can they be combined to show full activity time?
The table is laid out like this
LastName
FirstName
AccountNumber
ServiceCode
ActivityCode
ActivityDate
The activity code is either A for activate and D for deactivate
Activity date is a date field of ...
0
votes
1
answer
86
views
Teradata set role for a user is not working by c#
I am trying to build a console app that retrieves users from LDAP, creates the same users in Teradata, and grants privileges to these users based on their group membership.
My app is functioning well, ...
0
votes
1
answer
80
views
Join two tables in SQL with date condition
In the first table, I have client number, start date and other columns:
Client number
start date
other1
other2
xyz
2024-04-01
values10
values20
abc
2024-01-02
values11
values21
ert
2024-01-03
values12
...
0
votes
2
answers
136
views
Teradata query to Calculate Start and End dates Based on a condition
I have a dataset for certain STS codes and I need to retain the Start and End Date When Status =03
I have the following Data
HAVE
ID CHGDATE STS
101 11/21/2022 ...
-1
votes
1
answer
60
views
issue with case statement
Input data:
NUMBER
FLAG_1
FLAG_2
FLAG_3
FLAG_4
FLAG_5
FLAG_6
123456
X
X
X
X
X
X
Case stmt:
SELECT DISTINCT
NUMBER,
CASE
WHEN FLAG_1='X' AND FLAG_2='X' AND FLAG_3='X' THEN 'PRE'
WHEN FLAG_4='...
0
votes
1
answer
70
views
Teradata SQL Asst query - Error in where clause
I have included one 'where' clause which I was hoping to return output with reference to current_date but I am getting an error. Can someone please take a look at it and let me know what exactly I am ...
0
votes
1
answer
61
views
SQL Query Date time Suggestion
I have a SQL which gets data until yesterday by using where clause as
"
Where tpd."RELATIVE_GLOBAL_DAY" = -1
"
The db is defined as such that when I want to get todays data, I will ...
0
votes
0
answers
38
views
Teradata: expected something like ';' between the word 'multicasematch' and '('
I am trying out a MultiCaseMatch statement in Teradata where I get the error message "expected something like ';' between the word 'multicasematch' and '(' ". Would anyone be able to help me ...
-1
votes
1
answer
55
views
where clause using multiple conditions
Code1 | Code2 | Code3
----------------------
101| 102 | null
101| null | null
102| 104 | null
The above is the table called DiagCodes
Select *
From
Where
Where condition should check all the ...
0
votes
0
answers
62
views
Want to run Update in Teradata but with Inner joins
I want to update a column named 'FLAG' and set its value as C when the records from two different tables have a match on a few conditions. Please see the below sample of what I'm trying to achieve in ...
0
votes
1
answer
274
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 ...
0
votes
0
answers
41
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 ...
0
votes
0
answers
502
views
Facing issue converting string - UNICODE to LATIN
I am trying to insert data from table A to another table B having 900+ columns, but this is failing with this error:
Failure 6706 The string contains an untranslatable character.
I found out ...
0
votes
1
answer
705
views
Nested Case When Statements
Is there a more efficient way to write this case when statement so as to not have so many "when c.clm_its.host.cd IN...". I was thinking it could be possible to add a nested case when within ...
-1
votes
1
answer
51
views
Get first date that account-prod get discount sql
I have a huge volume of a history of transactions table with acc_nbr, tran_nbr, tran_amt, tran_dt, and tran_dis tran_prd
I need to find the first date for each acc_nbr and tran_prd
Find the First ...
0
votes
1
answer
390
views
Zero Results in division teradata
I try to divide to decimal columns
But keeps returns zeros if after casting to decimal
For example
A B
677.00 900.00
A/B
Returns 0.000
I try to divide to decimal columns
But keeps returns ...
1
vote
1
answer
64
views
Teradata Maximum process end time capture for multiple processes
I am trying to fetch data for one asset for reporting purposes which is dependent on multiple processes and start time should be the earliest job that starts among them and end time should be latest ...
0
votes
1
answer
198
views
How can I change a datetime value to a string, but keep the other values at Date value?
I'm dealing with a dateTime such as '1800-01-01 00:00:00' and I want to convert it to a string = 'N/A', but keep everything else as a dateTime.
I tried converting it to a string (To_char(date_time)) ...
0
votes
2
answers
330
views
I would like to generate a list of dates with timestamp at an hourly interval using SQL in teradata
just want to know if there is a way that I can generate a list of dates for a certain date range (e.g.2023-01-01 to 2023-01-20) with timestamp at an hourly interval in Teradata using SQL
Results that ...