teradata

Sequencing in Teradata

杀马特。学长 韩版系。学妹 提交于 2019-12-24 11:29:26
问题 I would like to create a SELECT query that results in a view that is 30 fields long and 1 record thick. 2 records if we're counting the title. The specific part of the larger query in question is: WHERE CAST(EVENT_TIMESTAMP AS DATE) - CONTRACT_EFFECTIVE_DATE = 1 This produces the results desired - records where the days between EVENT_TIMESTAMP and CONTRACT_EFFECTIVE_DATE is 1. But I'd like this for 30 days. Something like: WHERE CAST(EVENT_TIMESTAMP AS DATE) - CONTRACT_EFFECTIVE_DATE = 1:30

Changing column datatype from DECIMAL(9,0) to DECIMAL(15,0)

99封情书 提交于 2019-12-24 10:26:22
问题 Can you please help me concerning this matter (I didn´t found it in the Teradata documentation, which is honestly little overwhelming): My table had this column -BAN DECIMAL(9,0)-, and now I want to change it to - BAN DECIMAL(15,0) COMPRESS 0.- How can I do it? What does COMPRESS constraint 0. or any other mean anyway? I hope this is possible, and I don`t have to create a new table and then copy the data form the old table. The table is very very big - when I do COUNT(*) form that table I get

JDBC connection.getschema() AbstractMethodError

♀尐吖头ヾ 提交于 2019-12-24 09:58:15
问题 I am trying get the default database name from the connection for Teradata. I am using Teradata JDBC Driver 15.10.00.33. The following code gives me this abstract method error. Can anyone suggest me how I can get default database name using jdbc? Exception in thread "main" java.lang.AbstractMethodError: com.teradata.jdbc.jdk6.JDK6_SQL_Connection.getSchema()Ljava/lang/String; public class TestTDConnection { public static void main(String args[]) { String tdConnString = "jdbc:teradata://xx

How to connect to Teradata with C++ on linux

て烟熏妆下的殇ゞ 提交于 2019-12-24 09:08:16
问题 Simple Problem: I want to connect my linux based C++ program to a Teradata database. How do I accomplish this? I searched the web but I only found some ADO and ODBC based solutions for .net or JDBC drivers. Is there any lib out there that can do the job on linux without ODBC and .net? Greetings, Lars 回答1: Teradata Call-Level Interface Version 2 Reference for Network Attached Systems - Documentation Teradata Developer Exchange - Downloads - You can download the CLI for Linux, Windows, Solaris,

Convert Seconds to HH:MM:SS in teradata

孤人 提交于 2019-12-24 08:17:19
问题 I have a decimal(6,2) field storing data in seconds. I want those seconds to be converted in to HH:MM:SS. For ex: '19,500' seconds should be shown as 05:25:00 回答1: Assuming that the datatype is a typo (you can't store 19500 in a decimal(6,2)): col * INTERVAL '00:00:01' HOUR TO SECOND -- no fractional seconds col * INTERVAL '00:00:01.00' HOUR TO SECOND -- fractional seconds 来源: https://stackoverflow.com/questions/38521268/convert-seconds-to-hhmmss-in-teradata

Combine(concatenate) rows based on dates via SQL

自古美人都是妖i 提交于 2019-12-24 06:49:12
问题 I have the following table. Animal Vaccine_Date Vaccine Dog 1/1/2016 x Dog 2/1/2016 y Dog 2/1/2016 z Cat 2/1/2016 y Cat 2/1/2016 z I want to be able to combine vaccines that are on the same animal and same date, so that they appear in the same cell. The table below is what the desired end result would be. Animal Vaccine_Date Vaccine Dog 1/1/2016 x Dog 2/1/2016 y,z Cat 2/1/2016 y,z I have tried to create a volatile table to do so but I am not having any luck and I don't think Teradata

Combine(concatenate) rows based on dates via SQL

冷暖自知 提交于 2019-12-24 06:49:08
问题 I have the following table. Animal Vaccine_Date Vaccine Dog 1/1/2016 x Dog 2/1/2016 y Dog 2/1/2016 z Cat 2/1/2016 y Cat 2/1/2016 z I want to be able to combine vaccines that are on the same animal and same date, so that they appear in the same cell. The table below is what the desired end result would be. Animal Vaccine_Date Vaccine Dog 1/1/2016 x Dog 2/1/2016 y,z Cat 2/1/2016 y,z I have tried to create a volatile table to do so but I am not having any luck and I don't think Teradata

Is there a way to run an insert into statement with a valid “?” in it?

試著忘記壹切 提交于 2019-12-24 00:26:10
问题 I am trying to build an insert into statement that will include a URL string which has a valid "?" in it. I am using Teradata SQL Assistant (Windows XP) and it is trying to translate this into a parameter. Is there any way to override this and treat it as a character value? Example URL: https://www.location.com/livelink.exe?func=ll 回答1: Go to the Query tab on the Tools -> Options... page and uncheck the box labeled "Allow use of Named Parameters in queries". Here are the settings I use: That

Write from R to Teradata in 3.0

匆匆过客 提交于 2019-12-24 00:05:22
问题 R3.0 is not compatible with TeradataR and there are no plans to update the package or release the source code. Does anyone have a code snippet that shows how to write a dataframe to a new or existing Teradata table? sql <- "CREATE TABLE teradata.aaa (yr BIGINT, ct BIGINT, tax BIGINT)" tbl <- sqlQuery(ch, sql) # Creates a table, works # What syntax to insert a dataframe 'myData' into this table? 回答1: Sadly, I learned that bulk uploads are not supported. I had to simply INSERT each line of the

Early (or re-ordered) re-use of derived columns in a query - is this valid ANSI SQL?

时光毁灭记忆、已成空白 提交于 2019-12-23 09:41:31
问题 Is this valid ANSI SQL?: SELECT 1 AS X ,2 * X AS Y ,3 * Y AS Z Because Teradata (12) can do this, as well as this (yes, crazy isn't it): SELECT 3 * Y AS Z ,2 * X AS Y ,1 AS X But SQL Server 2005 requires something like this: SELECT X ,Y ,3 * Y AS Z FROM ( SELECT X ,2 * X AS Y FROM ( SELECT 1 AS X ) AS X ) AS Y 回答1: No, it's not valid ANSI. ANSI assumes that all SELECT clause items are evaluated at once. And I'd've written it in SQL 2005 as: SELECT * FROM (SELECT 1 AS X) X CROSS APPLY (SELECT