netezza

Select all columns from rows distinct on one column

只谈情不闲聊 提交于 2019-12-12 03:39:02
问题 I am using Netezza (based on PostgreSQL) and need to select all columns in a table for rows distinct on one column. A related question with answer can be found here, but it doesn't handle the case with all columns, going by that answer throws an error: select distinct on (some_field) table1.* from table1 order by some_field; Snippet from error with real data: "(" (at char 77) expecting '')'' 回答1: I don't think your code should throw an error in Postgres. However, it won't do what you expect

SQL Server passing tables Netezza

假装没事ソ 提交于 2019-12-11 22:08:55
问题 Just wondering what is best practice to achieve: We have stored procedure that runs in SQL Server and needs to do some calculations with a huge fact table to be stored on Netezza. The flow: Stored procedure will create temp tables on SQL Server These will be sent to Netezza to be joined with the fact table Calculations will be made in Netezza Results will be passed back to SQL Server What are the ways to pass the temp tables from SQL Server to Netezza? Thanks 回答1: The Only way that I know of

Netezza In-Built AGE function as UDF in Redshift

时间秒杀一切 提交于 2019-12-11 17:16:25
问题 I'm trying to Implement Netezza AGE function in Redshift as a UDF. I can able to get the correct answer in Python (Spyder IDE - Py 3.6) but when I execute it in Redshift as UDF, it gives me incorrect output. I've tried to execute as select AGE_UDF('1994-04-04 20:10:52','2018-09-24 11:31:05'); in Redshift. Here is the code used in RS UDF. CREATE OR REPLACE FUNCTION AGE_UDF (START_DATE TIMESTAMP, END_DATE TIMESTAMP) RETURNS varchar(100) stable AS $$ from datetime import datetime from dateutil

FOR loop Netezza issue

夙愿已清 提交于 2019-12-11 13:55:25
问题 I'm working with stored procedures in netezza. I want to loop over a range of values. The upper bound on the loop is passed as a variable into the sproc by the user. i.e. EXECUTE SPROC(12); so problem is that Netezza (aginity workbench) won't accept this input variable as the upper bound on the loop. i.e. DECLARE x alias as $1. begin for i in 1..x loop ...do stufff... end loop; end; I know that this can be solved using loop and exit style loop but It's eating me up as to why i can't do the

Netezza system catalog table constains duplicate records for external tables

别来无恙 提交于 2019-12-11 10:25:27
问题 In my Netezza box, I can see duplicate records in system tables. It is specific to EXTERNAL TABLE records as shown below Example: SYSTEM.ADMIN(ADMIN)=> CREATE EXTERNAL TABLE “Joe” (“Id” integer) SYSTEM.ADMIN(ADMIN)-> USING (DATAOBJECT(‘filename.csv’) SYSTEM.ADMIN(ADMIN)(> REMOTESOURCE ‘odbc’); CREATE EXTERNAL TABLE SYSTEM.ADMIN(ADMIN)=> select tablename, objtype from _v_table where tablename =’Joe’; TABLENAME | OBJTYPE ———–+—————- Joe | EXTERNAL TABLE Joe | EXTERNAL TABLE (2 rows) SYSTEM

How to connect to a User DSN using codeigniter?

前提是你 提交于 2019-12-11 07:38:32
问题 I am able to connect to a User DSN on my linux box (using ODBC). How do I get to connect using code igniter? in my database.php I have the default database: $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'user'; $db['default']['password'] = 'pass'; $db['default']['database'] = 'db_main'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] =

loading files with dates into netezza

自闭症网瘾萝莉.ら 提交于 2019-12-11 04:03:40
问题 I'm trying to import text file into netezza. As simplifie example I use the file with one column. File 01/04/2011 01/01/2099 01/01/2011 I have the table create table test_data (f date) I try to load data by insert into test_data select * from EXTERNAL 'C:\\Temp\\dt.txt' USING ( DATESTYLE 'DMY' DATEDELIM '/' MAXERRORS 100000000000 Y2BASE 2000 ENCODING 'internal' REMOTESOURCE 'ODBC' delimiter '\t' CRINSTRING TRUE TRUNCSTRING TRUE CTRLCHARS TRUE IGNOREZERO TRUE -- ESCAPECHAR '\' ) and I have no

Which Jenkins Hash Algorithm is used for the HASH8 function in Netezza ? One-at-a-time/lookup2/lookup3/SpookyHash?

旧时模样 提交于 2019-12-11 02:43:54
问题 I need to implement the hash8 function, or simulate its input/output in Java. Netezza's brief documentation says that hash8 implements Jenkins Algorithm, but there are multiple algorithms/revisions with that name. I am wondering which Jenkins algorithm/revision (one-at-a-time/lookup2/lookup3/SpookyHash) does hash8 use? Some of these hash algorithms also require a seed value. How can I get that? Any suggestions are welcomed. 来源: https://stackoverflow.com/questions/24853336/which-jenkins-hash

Grouping and Dividing Netezza

北慕城南 提交于 2019-12-11 02:19:03
问题 I have the following query that divides each row in the sum(rev) column by the sum of the column. For the following example the sum of sum(rev) column is 23193.The Divide column is derived by : row in sum(rev)/sum(rev) select date,id,sum(rev), NULLIF(rev,0) / sum(rev) over() as Divide from test where month(date) = 11 and year(date) = 2012 and day(date) = 02 and id = 'Client1' group by date,id,rev having sum(rev) <> 0 order by date date id sum(rev) Divide 2012-11-02 00:00:00 Client1 1562.00 0

Netezza aggregation issue (pivot)

社会主义新天地 提交于 2019-12-11 00:28:05
问题 I'm using Netezza to generate a report and I have the following query select b.group_name,a.group_id, PASS_FAIL, COUNT(*) from log a join group b on a.group_id=b.group_id group by b.group_name,a.group_id, PASS_FAIL It collects information on the number of passes and failures in a table like this: GROUP_NAME GROUP_ID PASS_FAIL COUNT GROUP1 4 FAIL 382 GROUP1 4 PASS 339 How can I change the query so that I can use PASS and FAIL as the columns. GROUP_NAME GROUP_ID PASS FAIL GROUP1 4 339 382 Pivot