Sponsored Content
Top Forums Programming DB2 Query -Convert multi values from column to rows Post 303012843 by RudiC on Saturday 10th of February 2018 01:50:03 PM
Old 02-10-2018
Please clarify: Do you want
  • database tables modified or inserted using
    • db internal tools (artisan[?] / SQL / ...)
    • external tools working on query results
  • output files to be operated upon
    • with which tools
    • with which results (store / print / transfer / ...)

Last edited by RudiC; 02-10-2018 at 04:13 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

flags to suppress column output, # of rows selected in db2 sql in UNIX

Hello, I am new to db2 SQL in unix so bear with me while I try to explain the situation. I have a text file that has the contents of the where condition that I am using for a db2 SQL in UNIX ksh. Here is the snippet. if ; then echo "Begin processing VALUEs" ... (1 Reply)
Discussion started by: jerardfjay
1 Replies

2. Shell Programming and Scripting

convert rows into column

if u have a data 2 4 6 8 5 4 4 5 6 then result shud be like 2 4 6 7 5 4 4 5 6 (3 Replies)
Discussion started by: cdfd123
3 Replies

3. Shell Programming and Scripting

Convert Column to rows

Hi, I have a file with below contents. Heading1 Heading2 Heading3 Heading4 Value1 Value2 Value3 Value4 The file has only 2 rows and is tab separated The desired output is : Heading1 Value1 Heading2 Value2 Heading3 Value3 Heading4 Value4 CAn you please help? (5 Replies)
Discussion started by: kaponeh
5 Replies

4. Shell Programming and Scripting

Sort the multi column rows

abc xyz - - - - - - - - - - - How to sort the second column in ascending order. (2 Replies)
Discussion started by: sandy1028
2 Replies

5. Shell Programming and Scripting

How to substract selective values in multi row, multi column file (using awk or sed?)

Hi, I have a problem where I need to make this input: nameRow1a,text1a,text2a,floatValue1a,FloatValue2a,...,floatValue140a nameRow1b,text1b,text2b,floatValue1b,FloatValue2b,...,floatValue140b look like this output: nameRow1a,text1b,text2a,(floatValue1a - floatValue1b),(floatValue2a -... (4 Replies)
Discussion started by: nricardo
4 Replies

6. Shell Programming and Scripting

How to convert values in a line to rows?

hi, I am basically running a sql that returns me values and I have stored them to a variable for example value of the variable will be: 123 124 345 now I want to write values stored in the variable into a file as 123 124 345 thanks in advance (3 Replies)
Discussion started by: babom
3 Replies

7. Shell Programming and Scripting

Convert Rows into Column

Hi Experts, I have a requirement to convert rows into columns. For e.g. Input File: Output File should be like Appreciate if you could suggest code snippet(may be awk) for above requirement... Thanks in Advance for your help... (3 Replies)
Discussion started by: sai_2507
3 Replies

8. Shell Programming and Scripting

Convert Column data values to rows

Hi all , I have a file with the below content Header Section employee|employee name||Job description|Job code|Unitcode|Account|geography|C1|C2|C3|C4|C5|C6|C7|C8|C9|Csource|Oct|Nov|Dec|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep Data section ... (1 Reply)
Discussion started by: Hypesslearner
1 Replies

9. Programming

DB2 Query to pick hierarchy values

Dear Team I am using DB2 v9 . I have a condition to check roles based on hierarchies like below example. 1.Ramesh has Roles as "Manager" and "Interviewer" 2.KITS has Roles as "Interviewer" 3.ANAND has Roles as "Manager" and "Interviewer" select * FROM TESTING NAME ... (6 Replies)
Discussion started by: Perlbaby
6 Replies

10. UNIX for Beginners Questions & Answers

DB2 Query modification to remove duplicate values using LISTAGG function

I am using DB2 v9 and trying to get country values in comma seperated format using below query SELECT distinct LISTAGG(COUNTRIES, ',') WITHIN GROUP(ORDER BY EMPLOYEE) FROM LOCATION ; Output Achieved MEXICO,UNITED STATES,INDIA,JAPAN,UNITED KINGDOM,MEXICO,UNITED STATES The table... (4 Replies)
Discussion started by: Perlbaby
4 Replies
DB2_FOREIGN_KEYS(3)							 1						       DB2_FOREIGN_KEYS(3)

db2_foreign_keys - Returns a result set listing the foreign keys for a table

SYNOPSIS
resource db2_foreign_keys (resource $connection, string $qualifier, string $schema, string $table-name) DESCRIPTION
Returns a result set listing the foreign keys for a table. PARAMETERS
o $connection - A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. o $qualifier - A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string. o $schema - The schema which contains the tables. If $schema is NULL, db2_foreign_keys(3) matches the schema for the current connection. o $table-name - The name of the table. RETURN VALUES
Returns a statement resource with a result set containing rows describing the foreign keys for the specified table. The result set is com- posed of the following columns: +--------------+---------------------------------------------------+ | Column name | | | | | | | Description | | | | +--------------+---------------------------------------------------+ | PKTABLE_CAT | | | | | | | Name of the catalog for the table containing the | | | primary key. The value is NULL if this table does | | | not have catalogs. | | | | |PKTABLE_SCHEM | | | | | | | Name of the schema for the table containing the | | | primary key. | | | | |PKTABLE_NAME | | | | | | | Name of the table containing the primary key. | | | | |PKCOLUMN_NAME | | | | | | | Name of the column containing the primary key. | | | | | FKTABLE_CAT | | | | | | | Name of the catalog for the table containing the | | | foreign key. The value is NULL if this table does | | | not have catalogs. | | | | |FKTABLE_SCHEM | | | | | | | Name of the schema for the table containing the | | | foreign key. | | | | |FKTABLE_NAME | | | | | | | Name of the table containing the foreign key. | | | | |FKCOLUMN_NAME | | | | | | | Name of the column containing the foreign key. | | | | | KEY_SEQ | | | | | | | 1-indexed position of the column in the key. | | | | | UPDATE_RULE | | | | | | | Integer value representing the action applied to | | | the foreign key when the SQL operation is UPDATE. | | | | | DELETE_RULE | | | | | | | Integer value representing the action applied to | | | the foreign key when the SQL operation is DELETE. | | | | | FK_NAME | | | | | | | The name of the foreign key. | | | | | PK_NAME | | | | | | | The name of the primary key. | | | | |DEFERRABILITY | | | | | | | An integer value representing whether the for- | | | eign key deferrability is SQL_INITIALLY_DEFERRED, | | | SQL_INITIALLY_IMMEDIATE, or SQL_NOT_DEFERRABLE. | | | | +--------------+---------------------------------------------------+ SEE ALSO
db2_column_privileges(3), db2_columns(3), db2_primary_keys(3), db2_procedure_columns(3), db2_procedures(3), db2_special_columns(3), db2_statistics(3), db2_table_privileges(3), db2_tables(3). PHP Documentation Group DB2_FOREIGN_KEYS(3)
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy