0 - 19 of 19 tags for cast

I have a VARCHAR column (CALL_START_DATE_TIME) and it's values are as shown below.


2014-OCT-31 15:52:35

2014-JUN-25 13:53:30

2013-DEC-26 19:56:40

2014-AUG-08 22:43:51

2015-APR-22 03:57:04


I need to apply date wise filter on this column as below:


This warning was returned in BTEQ after executing the following query. Is there something missing with the syntax? Please note that the SESSION TRANSACTION was set to ANSI and SESSION SQLFLAG was set to ENTRY. Both were configured intentionally.

I've read a few posts on this forum on how to force rounding to decimal places, but nothing is working. This is my latest attempt to try and have the results of a formula display decimals:

I'm running this query: 
I would hope that the query fails, but it works, the resulset is: 99251.
I'm working with TD14 and TD12.

I am running a BTQ script which is generating a .CSV file.
One of the column in the file is a number but datatype for the same in the parent table is defined as CHAR.
I am using a cast function to convert it into bigint( number is 13 digits long), results are fine when I am running this query in SQL Assiatant.

My customer has loaded a TD test table with a date & time column that looks like this:
Column:      XXXXXX   varchar(23) 
7/31/2014 9\:20\:03 AM
8/4/2014 8\:23\:15 AM
12/6/2014 2\:31\:07 PM 
What is the quickest/easiest way to convert the data to TIMESTAMP(6),  if possible at all ?   

I am a newbie in teradata and so am not familiar with casting/ formatting concepts...
can you please clarify the below queries...
1. I have an export using below syntax


Is there a way to convert string data into varbinary data type. I want to use the BYTE/BIT manipulation functions on a string column, but they can recieve only BYTEINT,INT, BIGINT and VARBYTE data types as arguments.
I tried this kind of cast:




I have a problem doing a CAST in this query to execute, get the error invalid timestamp.


(CAST( (CAST(TRIM(Stg.Fecha_Ejecucion_OOSS) AS CHAR(10)) || ' ' || CAST(TRIM(Stg.Hora_Ejecucion_OOSS) AS CHAR(8)))


I have a timestamp with time zone field and I would like to get the number of seconds that have elapsed from the start of that day.  This seems like it should be very trivial but I've searched for hours and tried many things that don't work.  What is a simple method for getting the number of seconds?

Hi all,


I tried the following two queries.


SELECT 1111 (CHAR(4));

Though both these queries use explicit casting, former is ANSI compliant whereas the latter is not.  I thought these queries will produce identical results but below is what I encountered.


I need to convert date, which is in the format 'MM/DD/YYYY', to the target format 'DD-MMM-YY'. I tried the following query and it worked too.


I would like to know if there is any other better way I can get this done.



I'm very much new to Teradata and writting queries as such. I have a CHAR Type column which contains data as follows

'2012-01-20 02:32:37.000000'.


How do I convert this CHAR type data to DATE Type, preferably as a timestamp?




I have to join two tables using a unique field but the trouble is one table has placed that unique field in all caps and the other table has the field in all lowercase. When joining these two they bring back nothing. When I look up the data individually I can find the same records in both tables.

This gets the date, how can I get the full timestamp?

SELECT (CAST('1970/01/01' AS DATE FORMAT 'yyyy/mm/dd')) + CAST(my_time/86400 AS INTEGER) AS CONVERTED_TIME
FROM myDatabase.myTable

I have a table with a column that is an integer and has Unix epoch time data.

Hello Folks,
I am new to Teradata.

I have a date column in one table (Table A) that I have to insert into a date column in another table (Table B)

Table A date type: TIMESTAMP (6)
Table B date type: TIMESTAMP (0)