table-functions

Read Excel from DB2

拜拜、爱过 提交于 2019-12-25 05:23:35
问题 I have to import some Excel data on a regular basis. Checking the DB2 documentation one can directly access OLE DB datasources via an external function. However I'm unable to set it up properly. I got the Microsoft Access Database Enginge 2010 plus the fix pack and installed it on the database server. I placed the excel file in a local directory from the database server. ( C:\Temp\test.xls ) The excel has a workbook called TEST1 and two rows ABC and DEF following some numeric data: ABC | DEF

How to include null values in `tablefunc` query in postgresql?

好久不见. 提交于 2019-12-22 08:45:10
问题 I'm trying to use the crosstab function in postgresql to create a pivot table . However, I'm having difficulty understanding how to structure my SQL within the query. My data consists of four columns and looks like this: I create this table using the following code: CREATE TABLE ct(id SERIAL, zone_id int, group_id int, area double precision); INSERT INTO ct(zone_id, group_id, area) VALUES(1,2,6798.50754160784); INSERT INTO ct(zone_id, group_id, area) VALUES(1,3,10197.7613124118); INSERT INTO

how to return temp table from postgres function?

馋奶兔 提交于 2019-12-11 09:26:29
问题 I have below query running fine independently, but showing many issues inside a postgres function CREATE TEMP TABLE tbl (h ltree, pathid int) ; CREATE TEMP TABLE temp_res (pathid int, res_count int) ; insert into tbl select l_tree,pathid from tblinfo where parentid in (880); insert into temp_res select T.pathid pathid from tblinfo p1, tbl T where index(p1.l_tree,T.h ) != -1 GROUP BY T.pathid order by T.pathid; select p.pathid pathid, p.name name, p.PBS PBS,p.parentid parentid,p.resid resid

PostgreSQL 9.3: Pivot table query

一笑奈何 提交于 2019-12-07 13:27:27
问题 I want to show the pivot table(crosstab) for the given below table. Table: Employee CREATE TABLE Employee ( Employee_Number varchar(10), Employee_Role varchar(50), Group_Name varchar(10) ); Insertion: INSERT INTO Employee VALUES('EMP101','C# Developer','Group_1'), ('EMP102','ASP Developer','Group_1'), ('EMP103','SQL Developer','Group_2'), ('EMP104','PLSQL Developer','Group_2'), ('EMP101','Java Developer',''), ('EMP102','Web Developer',''); Now I want to show the pivot table for the above data

PostgreSQL 9.3: Pivot table query

泪湿孤枕 提交于 2019-12-06 00:12:46
I want to show the pivot table(crosstab) for the given below table. Table: Employee CREATE TABLE Employee ( Employee_Number varchar(10), Employee_Role varchar(50), Group_Name varchar(10) ); Insertion: INSERT INTO Employee VALUES('EMP101','C# Developer','Group_1'), ('EMP102','ASP Developer','Group_1'), ('EMP103','SQL Developer','Group_2'), ('EMP104','PLSQL Developer','Group_2'), ('EMP101','Java Developer',''), ('EMP102','Web Developer',''); Now I want to show the pivot table for the above data as shown below: Expected Result : Employee_Number TotalRoles TotalGroups Available Others Group_1

How to include null values in `tablefunc` query in postgresql?

二次信任 提交于 2019-12-05 17:15:29
I'm trying to use the crosstab function in postgresql to create a pivot table . However, I'm having difficulty understanding how to structure my SQL within the query. My data consists of four columns and looks like this: I create this table using the following code: CREATE TABLE ct(id SERIAL, zone_id int, group_id int, area double precision); INSERT INTO ct(zone_id, group_id, area) VALUES(1,2,6798.50754160784); INSERT INTO ct(zone_id, group_id, area) VALUES(1,3,10197.7613124118); INSERT INTO ct(zone_id, group_id, area) VALUES(2,1,85708.8676744647); INSERT INTO ct(zone_id, group_id, area)