teradata

Removing replacement character � from column

时光总嘲笑我的痴心妄想 提交于 2019-12-08 00:53:49
问题 Based on my research so far this character indicates bad encoding between the database and front end. Unfortunately, I don't have any control over either of those. I'm using Teradata Studio. How can I filter this character out? I'm trying to perform a REGEX_SUBSTR function on a column that occasionally contains � , which throws the error "The string contains an untranslatable character". Here is my SQL. AIRCFT_POSITN_ID is the column that contains the replacement character. SELECT DISTINCT

Aggregation by timestamp

家住魔仙堡 提交于 2019-12-07 17:04:28
问题 SEO > SEO > Paid 1 Paid > Paid > Affiliate > Paid 1 SEO > Affiliate 1I have a query that results in a data containing customer id numbers, marketing channel, timestamp, and purchase date. So, the results might look something like this. id marketingChannel TimeStamp Transaction_date 1 SEO 5/18 23:11:43 5/18 1 SEO 5/18 24:12:43 5/18 1 Paid 5/18 24:13:43 5/18 2 Paid 5/18 24:12:43 5/18 2 Paid 5/18 24:14:43 5/18 2 Affiliate 5/18 24:20:43 5/18 2 Paid 5/18 24:22:43 5/18 3 SEO 5/18 24:10:43 5/18 3

DELETE query performance

倾然丶 夕夏残阳落幕 提交于 2019-12-07 06:07:30
问题 Original query delete B from TABLE_BASE B , TABLE_INC I where B.ID = I.IDID and B.NUM = I.NUM; Performanace stats for above query +-------------------+---------+-----------+ | Response Time | SumCPU | ImpactCPU | +-------------------+---------+-----------+ | 00:05:29.190000 | 2852 | 319672 | +-------------------+---------+-----------+ Optimized Query 1 DEL FROM TABLE_BASE WHERE (ID, NUM) IN (SELECT ID, NUM FROM TABLE_INC); Stats for above query +-----------------+--------+-----------+ |

query to return specific date from teradata timestamp(6)

那年仲夏 提交于 2019-12-07 03:43:33
问题 How can i search for a particular date for eg: '2013-10-22' from teradata timestamp(6) field? sel * from table A where date = '2013-10-22'; I tried the above query which is throwing error. Please help! 回答1: You may try like this:- sel * from table A where date = date '2013-10-22'; Since in ANSI standard form (must be preceded by the keyword DATE) Check out this 回答2: Something like this: where YourTimestampField >= {d '2013-10-22'} and YourTimestampField < {d '2013-10-23'} 回答3: And more

export result into excel sheet from teradata sql assistant

非 Y 不嫁゛ 提交于 2019-12-07 03:17:27
I want to export the results into excel sheet by running the query in Teradata SQL Assistant. I used copy paste but it didnt work Thanks in advance. If you return the answers to SQL Assistant you should be able to select Save Answerset from the File menu. You will then have the option to save it as a proper Excel file format. If you export the answers to a flat file directly the delimited text file can in turn be opened with ease in Excel and then saved as a proper Excel file format (XLS, XLSX, etc.) user5952841 Select the whole excel worksheet you will paste into and set the number format to

NullPointerException after extracting a Teradata table with Scala/Spark

雨燕双飞 提交于 2019-12-06 21:14:54
问题 I need to extract a table from Teradata (read-only access) to parquet with Scala (2.11) / Spark (2.1.0). I'm building a dataframe that I can load successfully val df = spark.read.format("jdbc").options(options).load() But df.show gives me a NullPointerException: java.lang.NullPointerException at org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter.write(UnsafeRowWriter.java:210) I did a df.printSchema and I found out that the reason for this NPE is that the dataset contains null

How can I lock a table for read and write so I can execute SQL and then remove the locks afterward?

邮差的信 提交于 2019-12-06 16:02:51
I am just now starting to dig into Teradata's locking features and Google is fairly convoluted with explanations on this. Hopefully, I can get a very simple and streamlined answer from SE. After encountering numerous issues with identity columns in Teradata, I've decided to create a mechanism that mimics Oracle's sequence. To do this, I am creating a table with two fields, one that holds a table name and the other that stores its last-used sequence. I am going to then create a stored procedure that takes a table name. Within the procedure, it will perform the following options: Select the last

Snapshot too old error

做~自己de王妃 提交于 2019-12-06 15:07:00
I am getting 'snapshot too old error' frequently while i am running my workflow when it runs for more than 5 hrs.My source is oracle and target is Teradata. Please help to solve this issue.Thanks in advance Rob van Wijk The best explanation of the ORA-01555 snapshot too old error that I've read, is found in this AskTom thread Regards. The snapshot too old error is more or less directly related to the running time of your queries (often a cursor of a FOR loop). So the best solution is to optimize your queries so they run faster. As a short term solution you can try to increase the size of the

Pyodbc Issue with Teradata

半世苍凉 提交于 2019-12-06 14:38:21
Getting below error while connecting with Teradata from pyodbc in Linux ('632', '[632] 523 630 (0) (SQLDriverConnect)') Details below: Connection String DRIVER={Teradata};DBCNAME=;UID=;PWD=;QUIETMODE=YES; Pyodbc Version:pyodbc-2.1.8 Python Version: 2.7.3 Teradata below: RELEASE 14.10.03.07 VERSION 14.10.03.06 Linux Host Details: 2.6.39-400.17.2.el5uek Please help. Need to export ODBCINI path, its done export ODBCINI=/opt/teradata/client/14.10/odbc_64/odbc.ini 来源: https://stackoverflow.com/questions/26621179/pyodbc-issue-with-teradata

SQL UPDATE row Number

假如想象 提交于 2019-12-06 14:24:40
I have a table serviceClusters with a column identity(1590 values). Then I have another table serviceClustersNew with the columns ID, text and comment. In this table, I have some values for text and comment, the ID is always 1. Here an example for the table: [1, dummy1, hello1; 1, dummy2, hello2; 1, dummy3, hello3; etc.] WhaI want now for the values in the column ID is the continuing index of the table serviceClusters plus the current Row number: In our case, this would be 1591, 1592 and 1593. I tried to solve the problem like this: First I updated the column ID with the maximum value, then I