All Forums

Topics related to the Teradata Database, excluding database connectivity (e.g. JDBC) and extensibility (e.g. UDFs) . Typical topics are about SQL syntax and usage (SELECT, GROUP BY etc), database performance, use of database functions, comparison with / migration from Oracle or DB2, and generally why the Teradata Database rocks. For articles, blogs and more, see the Database section of the site.

You must login to post to the forums.
Error While Trying to cast as Timestamp Topic by Saarang84 1 day ago Cast as Timestamp

I'm trying to modify a code script and trying to add a few new fields to it. The tricky part I come across while try to add these fields is while trying to cast them. I would need the format of a timestamp (calculated based on division / modulo of two fields) [Format is hh:mm:ss], but unable to cast it using timestamp.

4 replies, 15 min ago
convert month number to month name Topic by curtdugg 17 hours ago

Hello everyone; I am new to the forum and want to say hello to everyone. I am a system programmer working with SQL 2008R2, 1 month on the job and just got put on a major projects and I am drawing a blank wondering if someone could help me out.

1 reply, 17 hours ago
Error : A column or character expression is larger than the max size. Topic by KarthikB11 19 hours ago

I am running this code, but I keep on getting this error , if I do not cast it to CLOB , I get data row length exceeded, any suggestions ?

0 replies
TO_BYTES adding leading zero byte Topic by wavy 1 day ago TO_BYTES, conversion

Hi Teradata experts, I'm trying to write a query that selects a varchar column - which contains a valid hexidecimal character string - and converts it to it's byte representation.
So if I have the character string "FF" it will convert it to a byte value FF.

1 reply, 20 hours ago
PREPARE Statement in conjunction with Cursor Topic by rvphx 22 hours ago prepare, cursor, migration

Hello all,
This is my first post on the TeraData developer forum. So I apologize in advance if my question has already been asked earlier or I did not follow any convention.
I am migrating a TeraData stored procedure to SQL Server 2012. I really dont know anything about TeraData and its only for this specific project that I am using it. 

3 replies, 21 hours ago
TD_UNPIVOT throwing error: SELECT Failed. [9134] TD_UNPIVOT_CONTRACT; Help is confusing Topic by JerryLusa 4 days ago TD_UNPIVOT

The 14.10 help for TD_UNPIVOT has two examples, one with SELECT... FROM UNPIVOT, and another with SELECT... FROM TD_UNPIVOT.  Neither are working.
The UNPIVOT variation fails with "SELECT Failed.  [3707] Syntax error. expected something like ";" between the word UNPIVOT and '('. "

10 replies, 23 hours ago
Subquery in Case Statement Topic by vinaynaran 1 day ago

Hi All,
This is my first Post. I would like to run somthing using Case statement in Teradata SQL Assistant.
My Query as below
case when  Day_of_week = 2 then
  (sel top 5  Fld1,Fld2 from Table1)
   (sel top 5  Fld1,Fld2 from Table2)

1 reply, 23 hours ago
Urgent help- Need to check unique items from table1 and get dimension data from table 2 for those items Topic by jagz 1 day ago

I have a requirement:
Table A - contains Item information
Table B - contains physical dimension data for those items
Both are final tables
Both table have one column in common(idn)
I need to 

take Unique Items from Final table A  check in table B for how many we are getting the physical dimension data.

1 reply, 1 day ago
Aggregate join index can be loaded incrementally? Topic by SANDREOLI 1 day ago aggregate, aggregate join index

Aggregate join index can be loaded incrementally?
Is there a way to insert an incremental new data without  having to fully recharge an aggregate join index ?

0 replies
history handled output required Topic by sujiwarrier 4 days ago #sql

Hi ,
We have two tables with below data in given date intervals  and the output required is as single report  with its individual valid date intervals. Can anyone help on the query after joining Table A and Table B

Table A:

Cust_id   Currency   Start_date      End_date

1             USD         2014-01-01   9999-12-31


Table B:

9 replies, 1 day ago
FLAT SQL to SET SQL Topic by mcfabrero 3 days ago flat sql, set sql, cursors, cursor processing teradata stored procedures

Hi All,
I need your help in converting FLAT LOGIC(Flat SQL) Stored procedure to a SET LOGIC(SET SQL). From what I understand, a Flat logic is a cursor based SQL while SET logic works on sets of data. 
I have read several examples how to convert but it just basic examples. I have this cursor which I need to eliminate but can't figure out how.

2 replies, 1 day ago
Load Different DATE formats into Teradata Topic by spkother 1 day ago

  I have a requirement to load different date formats into teradata(Format MM-DD-YYYY HH:MM:SS) ,what is the transformation logic to handle different type of formats

1 reply, 1 day ago
3 replies, 1 day ago
Teradata Studios Create Local Variable Topic by darres90 16 Apr 2014 variable, parameter

I have a query that I would like to avoid hard coding. Using the following example could you give me the code to create such a variable:

1 reply, 2 days ago
Where to locate TPT API? Topic by magrawal 25 Aug 2006

I have installed the TTU8.1 but couldn't locate the include/libs for TPT API.Any idea from where to get developer's c++ sdk for TPT API like header files, libraries?Thanks.Mataprasad

3 replies, 2 days ago
Calculate Last Business Day of Previous Month Topic by Saarang84 4 days ago Last Business Day

I use the below select query to extract the last date of all completed months (current year to date) :

2 replies, 2 days ago
Padding a field in a select statement with spaces Topic by u156531 2 days ago

Hi, I have a column in a select statement that needs to always result in 19 characters including spaces. It will always be populated with a different number of characters so I need to know how to pad the end with spaces after the last character. Can someone give me the syntax for this.

1 reply, 2 days ago
Index on UPPER(col1) Topic by brim 2 days ago index

I discovered last night from UseTheIndexLuke that if there's an index on col1 and an often-used query uses UPPER(col1), the index will not be used because UPPER(col1) is not the same as col1. So the author recommended to use UPPER(col1) if it's an used often on the table.

2 replies, 2 days ago
How to execute a stored procedure from vba excel Topic by teradatauser2 4 days ago stored procedure, vba excel


2 replies, 2 days ago
Start dates overlap Topic by sunny.j 4 days ago dates overlap

I'm struggling to find a solution for the start dates overlap to continue with my analysis
unique_id     struc_name    per_id  username  start_dt  end_dt
001bbf    C10CHA00005     10225712    ?       14/10/2010    06/02/2013
001bbf2    H10CHA00002     10225712    ?      07/02/2013    08/02/2013

4 replies, 2 days ago
List of all Teradata Column Types with their associated DbTypes Topic by seanc 09 Jan 2014

In parsing MetaData from various Teradata servers/databases I have run into a lack of documention that I cannot find and would love to be pointed in the right direction. In the sample database that comes with Teradata all of the columns types are either one or two characters such as "BF" or "D".

2 replies, 2 days ago
Group by Case sensitive? Topic by rajesharra 2 days ago group by

Hi Team,
Today i am surprised, one of my query is returning duplicate data. I tried to find it with the qroup by, but it didnt picked the duplicate. Excel helped me.
All values are same, except case difrrence in one field one has small 'r' and other has 'R'. Group by considered this as unique.
Is it correct?

1 reply, 2 days ago
Calling External Stored Procedure from EXIT Handler Topic by umarfarman 24 Jan 2012 stored procedure, teradata, exit handler, external stored procedure, sqlstate, condition handler

Problem statement:


We want to set custom SQLSTATE in Teradata stored procedures. The only way to set custom SQLSTATE value is through external stored procedure.


1 reply, 3 days ago
Any good Teradata Material Topic by Abhishek_Parida 3 days ago

Any good Teradata Material

1 reply, 3 days ago
Out of spool space on disk Topic by vickyejain 3 days ago spool, out of spool, space

I have a situation on a productions system where our production jobs are failing with the 'Out of spool space on disk' error since yesterday. This process has been running for over a year and the data volumes being processed are consistent with the usual.

2 replies, 3 days ago