teradata

Teradata 15: Failure 7545 Identity Column is over its limit

烈酒焚心 提交于 2021-02-10 14:56:06
问题 I got this Teradata failure 7545 Identity Column is over its limit, but I am only insert a few hundreds records and i have already change data type from INT to BIGINT. Here is my create table syntax, I am really puzzled why Teradata was not happy? CREATE TABLE LOCATION ( LOCATION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1 MAXVALUE 1000000) , .... Any insight would be greatly appreciated 回答1: Your definition defaults to NO CYCLE and MAXVALUE is set to 1000000 , so

Regex syntax in teradata

a 夏天 提交于 2021-02-10 13:09:24
问题 In functions like REGEXP_REPLACE , REGEXP_SIMILAR we need to mention the regular expression for matching a part of the string. Does the regex follow same syntax as that of regex in java or does Teradata have a separate syntax for regular expressions? 回答1: It's the same as PCRE (C, Java, PHP, Javascript). For example, let's say you have a bunch of emails and you want just the web domains from that you would use SELECT RegExp_Replace(email, '^.*@(.*)', '\1', 1, 0, 'i') FROM emails; You could

Select all Table/View Names with each table Row Count in Teredata

霸气de小男生 提交于 2021-02-08 09:59:04
问题 I have been stuck into a question. The question is I want to get all Table name with their Row Count from Teradata. I have this query which gives me all View Name from a specific Schema. I ] SELECT TableName FROM dbc.tables WHERE tablekind='V' AND databasename='SCHEMA' order by TableName; & I have this query which gives me row count for a specific Table/View in Schema. II ] SELECT COUNT(*) as RowsNum FROM SCHEMA.TABLE_NAME; Now can anyone tell me what to do to get the result from Query I

Select all Table/View Names with each table Row Count in Teredata

别说谁变了你拦得住时间么 提交于 2021-02-08 09:58:57
问题 I have been stuck into a question. The question is I want to get all Table name with their Row Count from Teradata. I have this query which gives me all View Name from a specific Schema. I ] SELECT TableName FROM dbc.tables WHERE tablekind='V' AND databasename='SCHEMA' order by TableName; & I have this query which gives me row count for a specific Table/View in Schema. II ] SELECT COUNT(*) as RowsNum FROM SCHEMA.TABLE_NAME; Now can anyone tell me what to do to get the result from Query I

Teradata partitioned query … following rows dynamically

孤街醉人 提交于 2021-02-08 08:29:45
问题 I have a table with the following columns and data. Data describes certain customer activity periods cust_id s_date e_date 11111 01.03.2014 31.03.2014 11111 10.04.2014 30.04.2014 11111 01.05.2014 10.05.2014 11111 15.06.2014 31.07.2014 22222 01.04.2014 31.05.2014 22222 01.06.2014 30.06.2014 22222 01.07.2014 15.07.2014 And I want to write a query which gives this result: cust_id s_date e_date 11111 01.03.2014 10.05.2014 11111 15.06.2014 31.07.2014 22222 01.04.2014 15.07.2014 The query result

Teradata partitioned query … following rows dynamically

不打扰是莪最后的温柔 提交于 2021-02-08 08:29:16
问题 I have a table with the following columns and data. Data describes certain customer activity periods cust_id s_date e_date 11111 01.03.2014 31.03.2014 11111 10.04.2014 30.04.2014 11111 01.05.2014 10.05.2014 11111 15.06.2014 31.07.2014 22222 01.04.2014 31.05.2014 22222 01.06.2014 30.06.2014 22222 01.07.2014 15.07.2014 And I want to write a query which gives this result: cust_id s_date e_date 11111 01.03.2014 10.05.2014 11111 15.06.2014 31.07.2014 22222 01.04.2014 15.07.2014 The query result

teradata export from hive to teradata class not found

◇◆丶佛笑我妖孽 提交于 2021-02-08 06:50:51
问题 I am trying to export from hive table to teradata using TDCH connector, I am getting below errror:- 15/05/07 08:01:03 INFO tool.ConnectorExportTool: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at com.teradata.connector.common.tool.ConnectorJobRunner.runJob(ConnectorJobRunner.java:81) at com.teradata.connector.common.tool.ConnectorExportTool.run(ConnectorExportTool.java

Teradata FIFO Script

大憨熊 提交于 2021-02-07 10:45:40
问题 There is an old stack post (First-in-first-out (FIFO) inventory costing) that contains the Set-based Speed Phreakery: The FIFO Stock Inventory SQL Problem: (https://www.simple-talk.com/sql/performance/set-based-speed-phreakery-the-fifo-stock-inventory-sql-problem/). I have been trying to adapt it from SQL Server to Teradata SQL but have discovered that: (a) Teradata can only handle one CTE with statement (b) You cannot use cross apply (c) You cannot use hint indexes? My questions are: Is

SQL Rounding Percentages to make the sum 100% - 1/3 as 0.34, 0.33, 0.33

北城以北 提交于 2021-02-07 09:22:08
问题 I am currently trying to split one value with percentage column. But as most of percentages values are 1/3, I am not able to get aboslute 100% with two decimal points in the value. For example: Product Supplier percentage totalvalue customer_split decimal(15,14) (decimal(18,2) decimal(18,2) -------- -------- ------------ --------------- --------------- Product1 Supplier1 0.33 10.00 3.33 Product1 Supplier2 0.33 10.00 3.33 Product1 Supplier3 0.33 10.00 3.33 So, here we are missing 0.01 in the

SQL Rounding Percentages to make the sum 100% - 1/3 as 0.34, 0.33, 0.33

谁说我不能喝 提交于 2021-02-07 09:20:59
问题 I am currently trying to split one value with percentage column. But as most of percentages values are 1/3, I am not able to get aboslute 100% with two decimal points in the value. For example: Product Supplier percentage totalvalue customer_split decimal(15,14) (decimal(18,2) decimal(18,2) -------- -------- ------------ --------------- --------------- Product1 Supplier1 0.33 10.00 3.33 Product1 Supplier2 0.33 10.00 3.33 Product1 Supplier3 0.33 10.00 3.33 So, here we are missing 0.01 in the