teradata

Outputting Japanese Characters to a File using Python

断了今生、忘了曾经 提交于 2019-12-02 07:07:44
问题 Goal --> I am trying to automate the query execution process using Python Detail --> My Source is Teradata Database and Destination is .txt file I am writing a Python code to run a query in Teradata and save the output in .txt file. Issue --> Even though,I am able to run the query and save the output,The Japanese Character are showing up as "\x1a\x1a" For ex . when i run the query the output i see in Teradata SQL Assistant window is "愛してる”  while the output in text file is "\x1a\x1a" I am

Timestamp to epoch conversion in teradata

倖福魔咒の 提交于 2019-12-02 05:55:55
I have a TIMESTAMP column in a teradata table. I want to convert the timestamp to epoch value. Can someone shed some light on how to do this. This is a SQL UDF I wrote a few years ago. If you don't have access rights to create a function, you mighty ask you dab or simply cut & paste the calculation. /********** Converting a Timestamp to Unix/POSIX/epoch time Unix time: Number of seconds since 1970-01-01 00:00:00 UTC not counting leap seconds (currently 34 in 2010) The maximum range of Timestamps is based on the range of INTEGERs: 1901-12-13 20:45:52 (-2147483648) to 2038-01-19 03:14:07

Teradata: How can I raise an error in a stored procedures

白昼怎懂夜的黑 提交于 2019-12-02 05:18:49
问题 Is there a way to raise errors inside of Teradata stored procedures? For example, I want to check if a table is empty. If the table is empty I wish to cause the stored procedure to error out with the error message "Table Empty". That will allow me to bubble up the error to the calling application. 回答1: TD13+ implements Standard SQL's SIGNAL/RESIGNAL. 来源: https://stackoverflow.com/questions/23399461/teradata-how-can-i-raise-an-error-in-a-stored-procedures

How to sum the activity time that occurred within 15-minute intervals using overlapping start and stop times(SQL)(t-SQL)

被刻印的时光 ゝ 提交于 2019-12-02 04:20:26
问题 I'd like to write a query that will calculate the total amount of activity that occurred within each 15 minute interval of the day using only timestamps that correspond to activity start and stop times. Here is a sample data set: DATE StartDateTime StopDateTime 2/2/2015 2/2/2015 7:00 2/2/2015 7:25 2/2/2015 2/2/2015 7:20 2/2/2015 7:29 2/2/2015 2/2/2015 7:35 2/2/2015 7:42 2/2/2015 2/2/2015 8:05 2/2/2015 8:14 2/2/2015 2/2/2015 8:16 2/2/2015 8:20 2/2/2015 2/2/2015 8:29 2/2/2015 8:40 2/2/2015 2/2

How to execute multiple queries in teradata?

只谈情不闲聊 提交于 2019-12-02 04:20:09
For example a query : create table ; select xxx ; delete ; How to execute it in one session ? I saw one answer to a similar question about mysql. The trick is to turn on allow multiple queries String dbUrl = "jdbc:mysql:///test?allowMultiQueries=true"; For teradata specifically, what is the solution ? I tried String dbUrl = "jdbc:odbc:dsn?allowMultiQueries=true"; It is not properly working ? You're looking for a Multi Statement Request (MSR). It's simply sending multiple SQL statements to the server sepatarated by semicolons. But you can't mix DDL and DML in a single MSR because DDL must be

How can I create a table with a dynamic name (based on current_date) and reference to it in INSERT statements?

前提是你 提交于 2019-12-02 04:09:59
At the moment I have to rerun data selection query every month, where I create one base table. This table is named something like MyDB.MyTable_Current_Date , so for today that would be MyDB.MyTable_201811 using YYYYMM date format. Instead of having to set the name manually (using ctrl + h), I would like this to be done automaticaly. My goal is that I can open the SQL and run the query where the the table that is created is MyTable_YYYYMM . Note: eventually I want to also let the SQL run automatically every month, but for now this is a nice first step for my understanding. I made the below

Teradata: How can I raise an error in a stored procedures

前提是你 提交于 2019-12-01 23:25:35
Is there a way to raise errors inside of Teradata stored procedures? For example, I want to check if a table is empty. If the table is empty I wish to cause the stored procedure to error out with the error message "Table Empty". That will allow me to bubble up the error to the calling application. dnoeth TD13+ implements Standard SQL's SIGNAL/RESIGNAL . 来源: https://stackoverflow.com/questions/23399461/teradata-how-can-i-raise-an-error-in-a-stored-procedures

Connect Python to Teradata in mac with pyodbc

廉价感情. 提交于 2019-12-01 23:02:40
I successfully installed pyodbc module for python 2.7. However, when input the following code to connect to teradata, import pyodbc conn = pyodbc.connect('DRIVER={Teradata};DBCNAME=<tdwc>;UID=<UID>;PWD=<UID>;QUIETMODE=YES;') I got the following error; Traceback (most recent call last): File "", line 1, in pyodbc.connect('DRIVER={Teradata};DBCNAME=;UID=;PWD=;QUIETMODE=YES;') Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen(/Library/Application Support/teradata/client/ODBC/lib/tdata.dylib, 6): Library not loaded: libtdparse.dylib\n Referenced from: /Library/Application Support/teradata

How to insert data from an excel sheet into a database table?

纵饮孤独 提交于 2019-12-01 14:23:45
I need to insert the data from an excel sheet into a teradata table. and I need this to be done using a MACRO. I have data in an excel sheet like COL1 COL2 COL3 COL4 1 2 3 4 2 5 8 10 . . so on and i need to keep a button in the excel sheet and assign a macro to that button so that when i click the button the rows in the excel sheet should be inserted into a database table. The requirement is that I will send the empty excel sheet to the person, he will fill in the sheet with the data and he clicks the button in the excel and the data has to be inserted into the database table. I would prefer

How to insert data from an excel sheet into a database table?

强颜欢笑 提交于 2019-12-01 13:01:13
问题 I need to insert the data from an excel sheet into a teradata table. and I need this to be done using a MACRO. I have data in an excel sheet like COL1 COL2 COL3 COL4 1 2 3 4 2 5 8 10 . . so on and i need to keep a button in the excel sheet and assign a macro to that button so that when i click the button the rows in the excel sheet should be inserted into a database table. The requirement is that I will send the empty excel sheet to the person, he will fill in the sheet with the data and he