5,641 questions
0
votes
0
answers
23
views
Setting Up LDAP Authentication for Teradata ODBC Connection in R Without Manual Credential Input
I performed the necessary configuration in the ODBC driver version 16.20 DSN Setup, and the connection seems to work. However, in R, I want to establish the connection without having to manually enter ...
0
votes
2
answers
66
views
Finding the number of previous tickets in the last 30 days
I'm trying to add a column for "number of tickets in the last 30 days" to a query of all tickets in 2024. What I've got so far:
SELECT customer_id,
ticket_number,
ROW_NUMBER() ...
0
votes
0
answers
40
views
Teradata Query Performance
Below query is running for long time with high CPU and IO usage.
Mainly because of last AND condition.
SELECT
A.CLMN1
,COALESCE(G.oDY_CNT,1) AS DY_CNT
FROM
DBNAME....
1
vote
1
answer
38
views
Teradata SQL to see if customer has unique National Insurance Number
I have a list of customers and each customer should have a distinct national insurance number assigned. Some customers will have the same NIN. How do I write the query to check whether each customer ...
1
vote
1
answer
46
views
Reading Polygon data from Teradata into Tableau
I understand Tableau can't read a clob field in Teradata where I have the Polygons. However I understand there is a work around to extract data that can be used by Mapping capabilities of Tableau. Can ...
0
votes
0
answers
100
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 ...
-3
votes
0
answers
55
views
Updating a column based on a condition when source table has duplicate records
This is similar to a question that I had asked previously. I was not able to update that question.
Current State:
Desired Output:
In the first scenario, for med_id=12345, casemgr_id=99012, ...
0
votes
2
answers
76
views
For duplicate rows, creating a column that shows status based on date
I am hoping for some help with the scenario below in SQL
Current State:
For a particular combination of med_id, casemgr_id, casemgr_clnt_id, the status should be reflected accordingly:
Desired Output:...
0
votes
3
answers
70
views
Rewriting query
I have a scenario where I want to take only one row from a group based on the column values in TID column. For example my key columns in the table SRN,GIO and FID. Now there is another column TID, now ...
1
vote
1
answer
30
views
Teradata SQL workday function?
In Excel I can do WORKDAY Function like this =WORKDAY("2024/11/15";15)
How if applied to SQL TERADATA? or is there a way to display the date 15 days in the future by excluding Weekend ?
I ...
0
votes
1
answer
51
views
How can I separate RowNumber counting?
I'm trying to create a point in time hierarchy in my organization. The problem I'm running into are some folks have reported to the same manager more than once in their career. I tried doing a ...
0
votes
1
answer
43
views
TDML: Error occured while writing to garbage collector file
I was facing the error above in teradataml py package on Win11, when using Dataframe.from_query().
But I am sure the exception would be triggered in (many) other methods.
Why ?
Because of a generic ...
3
votes
1
answer
40
views
Finding customers who've had multiple tickets within a 3-day period over the last month
I have a table that includes columns for receive_date, customer_id, and ticket_number. I want to find all the tickets for customers who've had more than 1 ticket created within 3 days of each other.
...
0
votes
1
answer
31
views
Condensing history table for teradata SQL
I have a history table that tracks all sorts of changes to different fields. I only need to analyze the changes to [MTN_STATUS_IND]. Because it's a history table that tracks a lot of changes there ...
3
votes
3
answers
75
views
Check how many rows in a grouping have the MAX value SQL
My dataset looks like this:
TEAM_ID PLAYER_ID NUM_POINTS
21 39 20
21 50 10
21 67 10
22 74 0
22 73 0
I want ...
0
votes
0
answers
33
views
Teradata FastExport Issue: Incorrect Export Column into Mainframe PS File
I’m trying to export data from a Teradata table into a Mainframe PS file using FastExport, but one of the columns contains a [C] value, and it’s not being exported correctly. Instead of square ...
0
votes
0
answers
37
views
Export data to CSV using Teradata BTEQ
I am trying to export data in CSV format using BTEQ, via Windows command line or batch.
When trying I get an output in a fixed width columns format or an even stranger format in only one column.
What ...
0
votes
2
answers
77
views
How to Populate Column Values Based on Conditions in SQL?
I’m trying to explain an interesting scenario I’m facing in SQL. I’m not sure if there’s a specific window function or other keywords to achieve this, but let me explain.
I have a table structured as ...
0
votes
1
answer
45
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
30
views
TD_Smote function in Teradata
I am attempting to run the Smote function in Teradata uisng the code below which is taken directly from the terdata guidance document.
SELECT * FROM TD_SMOTE (
ON iris_enc_sample AS InputTable ...
0
votes
1
answer
68
views
Combining XML files Using SQL
I want to combined mulitple exisiting XML files into one XML output file.
I am a new developer and still learning.
I have a table with four columns - ROWID, XMLMESSAGE, BUS_DTE, DW_LOD.
I want to ...
0
votes
1
answer
48
views
How to get the table name from Teradata QryLog for INSERT, UPDATE and Delete statement
I have a task to extract the Target tablename involved in INSERT, UPDATE and DELETE operation in Teradata
for an example
if the SQL in dbc.Qrylog is below - I need TD.Employee alone;
INSERT into TD....
1
vote
2
answers
80
views
Extracting value from comma-delimited string in Teradata
I need the value extracted from between the 5th and 6th comma of a string. STRTOK() is skipping the positions that are empty and not counting them. For example, this returns null because there are not ...
0
votes
0
answers
35
views
How to connect to TeraData in Mule application using trustStore in TLS based on Generic connection?
I'm trying to connect to teraData using Mule application. i'm able to establish connectivity using Generic connection where i pass the db creds via URL. However,
i wanted to establish connectivity ...
0
votes
1
answer
49
views
Max number of characters in schema definiton for inline-transfer of CLOBs
I've written a TPT job script that transfers data from a DB2 table to Teradata via ODBC.
There are CLOB fields in the source table, which I also want to transfer. When I don't define a length for the ...
0
votes
0
answers
58
views
Teradata Table Size
I am using the following SQL query to calculate the size of a table in Teradata:
SELECT
A.DatabaseName,
A.TableName,
B.CreateTimeStamp,
CAST(SUM(CURRENTPERM) AS DECIMAL(18,2))/(...
1
vote
1
answer
69
views
Multiple groups based on conditions in SQL
There is one scenario where I am struggling to implement a logic in Teradata, I have a table as shown below.
My key columns are COLA and COLB, now the logic which I need to implement is that within ...
-1
votes
1
answer
54
views
running normal java non-spark application in spark cluster
I want to run/execute a normal java application which connects to teradata database.
I would like to run this java app in spark cluster although my java app is non-spark.
Questions are as follows
Is ...
0
votes
0
answers
42
views
What is the Teradata equivalent of FormatNumber()?
Below is an expression from SQL Server Reporting:
ToNumber(Left(FormatNumber([ColName];"00";1))
How to acheive this in Teradata?
I have tried the following:
CAST(SUBSTRING(TO_CHAR([ColName]...
2
votes
2
answers
72
views
Teradata Windows analytical function to select the correct records from partition
I have just 2 columns for partition and on basis of those two columns, need to select the appropriate dates.
Input Data:
strt_dt
end_dt
ID
Amt
2023-09-29
2023-10-01
ID1
100
2023-10-02
2023-10-02
...
-1
votes
1
answer
58
views
Replace null from another row
I have a scenario where I am struggling to write the logic. I tried case and max functions, but it's not working.
I have a table as shown below, with key columns Ref1 and Ref2. Now there is a scenario ...
0
votes
1
answer
45
views
SQL (Oracle or Teradata) assign state to customer based on where they buy the most
Consider table structured like
CustomerNum
state
sales_volume
1
NJ
5000
1
NY
25
5
WA
1250
5
OR
85
5
MN
3100
How would I produce output that tacks on a "winning" state by
customer ...
0
votes
1
answer
43
views
calculate fees paid in 12 month period
I have created a static calender table in Teradata
CREATE VOLATILE TABLE calender AS (
SELECT DISTINCT Add_Months(Last_Day(calendar_date) + 1, - 12) AS Period_Start
,Last_Day(calendar_date)...
0
votes
2
answers
63
views
Use compound keys with STRTOK_SPLIT_TO_TABLE in teradata
I'm trying to use STRTOK_SPLIT_TO_TABLE in teradata to split space delimited column into multiple rows. All other column values should be repeated in the new rows. I can't find anywhere in TD ...
1
vote
1
answer
55
views
For loop Teradata insert statement
I am pretty new to Python and looking for some assistance.
I have a large number of Teradaat tables and I am looking to take a single field from each of theose tables and put it into a new table. ...
0
votes
1
answer
50
views
Teradata SQL using recursive logic in SQL
I am using Teradata and there is a scenario which I am not sure how to achieve it using sql query. I have a table with data as given below. The table is grouped based on the columns GP,Key1,Key2 and ...
0
votes
1
answer
31
views
Teradata summary query
Sample input
stl_dt
stst_cd
2024-07-25
12
2024-07-28
12
2024-07-28
14
Expected output:
Type
Total
A1
2
A2
3
A3
1
If stst_cd is 12 then A1 is 1
If stl_dt<current_date then A2 is 1
If ...
0
votes
0
answers
40
views
Why do I get no results from cursor.execute() and cursor.fetchall() using Python teradatasql driver?
Trying to query a Teradata database from Python using teradatasql, but cursor.execute() and cursor.fetchall() return nothing. I verified this SQL statement should return a single column of 259 ...
0
votes
0
answers
52
views
Extract query text in Teradata , from dbc.dbqlsqltbl
I'm trying to extract a query text from
dbc.dbqlsqltbl.
My goal is to extract the query text using export file in bteq , and then execute the query using run file.
for example:
.export report file = ...
0
votes
0
answers
71
views
Spring batch 5.x JpaPagingItemReader Adding "Top ?" to teradata query
I have a spring batch application that was running fine in spring batch 3.x, then it was upgraded to 5.x and it started to fail with:
Syntax error, expected something like an integer or a decimal ...
1
vote
1
answer
38
views
Teradata Studio installation: Choosing the right zip file
I would like to install Teradata Studio on my computer. I have found the right webpage: https://downloads.teradata.com/download/tools/teradata-studio, and (after a free registration) I can view the ...
0
votes
0
answers
39
views
bigquery data transfer service is not syncing with Teradata extraction in Python
The need is to extract the data from Teradata to bigquery using bigquery data transfer service BQ DTS in my python code.
what I faced the problem here is I am unable to pass teradata connection ...
-2
votes
1
answer
57
views
How do you insert rows for missing products per group in teradata sql
I want to retrieve a complete list of all products associated with each ID. This list should include products that are present in Table1, as well as any products that are not in Table1. For products ...
0
votes
0
answers
74
views
Continue on Error in Automic JobStep after script call with non-zero return code
I do have an automic job step which calls a BTEQ script (but just think of any kind of script which return an error code). Something like:
BTEQ "filename"
Now I want to introduce some ...
0
votes
1
answer
69
views
Teradata - Get unique values among the column in a row
How to obtain unique values from a set of columns for each row in a table.
Consider the following table structure:
COL1 | COL2 | COL3 | COL4
--------------------------
1 | 1 | 2 | 3
2 | ...
0
votes
1
answer
76
views
Encoding problem while querying data from TeradataDB to dataframe in Python
I have this problem that I can't solve. We have table in Teradata database. Let's say that our table has only one row (Świdnica - Polish word) and one column (addresses).
Column 'addresses' is defined ...
0
votes
0
answers
36
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
0
answers
18
views
Strange error when calling RANDOM function in Teradata from .Net
I have the following piece of code:
try
{
var con = new TdConnection("....");
var com = new TdCommand("SELECT MyID, RANDOM(?, ?) FROM MyTable", con);
var p1 = new ...
0
votes
0
answers
51
views
WHERE clause appearing AFTER a GROUP BY clause in Teradata
I've run across a query in Teradata that has me a bit confused. Consider the following query:
SELECT
ID
, MIN(In_Time) as In_Time
, MAX(Out_Time) as Out_Time
FROM table
GROUP BY 1
WHERE In_Time IS ...
0
votes
0
answers
46
views
Teradata - Get amount from earliest transaction with precedence rule
Summary
Derive the last triggering amount based on the following precedence rules.
Earliest triggering transaction by sequence in the base_key's period.
If no triggering transaction is found in the ...