473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

creating a Report

vp
Hi all,

Can we create a report of this format using DB2.
Report#
Date:

column1 column2 column3
total
Field Name1 999 999 999
9999

Field Name 2 888 888 88
8888

Field Name 3 77 77 777
7777
Please suggest me a way to do... as of now I am using DB2 SQL in AIX
korn shell script... and we are not using any tool so is the problem...

thanks

Mar 2 '06 #1
11 1807

vp schrieb:
Hi all,

Can we create a report of this format using DB2.
Report#
Date:

column1 column2 column3
total
Field Name1 999 999 999
9999

Field Name 2 888 888 88
8888

Field Name 3 77 77 777
7777
Please suggest me a way to do... as of now I am using DB2 SQL in AIX
korn shell script... and we are not using any tool so is the problem...

thanks


are you trying to reformat a resultset (tabular-output) you are getting
with:
( only an example!)
db2 "select name,amount,remark from user_table"

NAME AMOUNT REMARK
--------------------------- --------------------
-----------------------------------------
Bush 10000.00 president
Schwarzenegger 20000.00 gouvernor

2 record(s) selected

to a report look-alike with header, footer, sum-ups ? or what are you
trying to achieve ?

use a perl-script to parse the output from the db2-command

joerg

Mar 3 '06 #2
vp
Hi,

I have data coming from DB2 tables using EXPORT utility and on top of
it I have to include some text to identify every column and row with
some CAPTION.
thanks

Mar 3 '06 #3
vp wrote:
Hi,

I have data coming from DB2 tables using EXPORT utility and on top of
it I have to include some text to identify every column and row with
some CAPTION.


Yes, you can. Another thread discussed this just last week. Have a look
there.

In short, you can add another row that contains the caption:

VALUES 'col1', 'col2', 'col3'
UNION ALL
SELECT ...

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 3 '06 #4
vp
Yes I am using

VALUES 'col1', 'col2', 'col3'
UNION ALL
SELECT.....

and I am getting something like
col1 col2 col3
12 78 90
34 87 45

But I need something like
col1 col2 col3
ROW1 12 78 90
ROW2 34 87 45

How should I add ROW1 and ROW2 names in this format...

Mar 3 '06 #5
vp wrote:
Yes I am using

VALUES 'col1', 'col2', 'col3'
UNION ALL
SELECT.....

and I am getting something like
col1 col2 col3
12 78 90
34 87 45

But I need something like
col1 col2 col3
ROW1 12 78 90
ROW2 34 87 45

How should I add ROW1 and ROW2 names in this format...


VALUES '', 'col1', 'col2', 'col3'
UNION ALL
SELECT 'ROW' || CHAR(ROW_NUMBER() OVER()), ...
--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 3 '06 #6
vp
Hi Knut,

I have caption in text for ROW1 and ROW2

Not sure how I could use ur idea ..

VALUES '', 'col1', 'col2', 'col3'
UNION ALL
SELECT 'ROW' || CHAR(ROW_NUMBER() OVER()), ...
thanks

Mar 6 '06 #7
vp wrote:
Hi Knut,

I have caption in text for ROW1 and ROW2

Not sure how I could use ur idea ..

VALUES '', 'col1', 'col2', 'col3'
UNION ALL
SELECT 'ROW' || CHAR(ROW_NUMBER() OVER()), ...


I don't know what you mean with "caption in the text"

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 7 '06 #8
vp
I am sorry for the confusion..

I want some thing like

member_id ssn total

INS_CD 2 5 7
DIS_CD 4 4 8

Can the above cross tab table be implemented using DB2 SQL??

Mar 7 '06 #9
What are the source table(s)?
Please show me DDL(s) and sample data that produced your example.
INS_CD 2 5 7
DIS_CD 4 4 8


Mar 10 '06 #10
vp
Hi,

I dont have a DDL yet... I have a single table were I am pulling data
for the fields...
men women total
INS_CD 2 5 7
DIS_CD 4 4 8

I have to add text like INS_CD and DIS_CD, men, women, total since I am
not getting it from the table. All i am pullng fromt eh table are
2,5,7,4,4,8...

thanks

Mar 10 '06 #11
For the top row, it can be added to the query with a UNION ALL. For the
side bar, a table can be constructed with a WITH statement, and JOINed
into the output table, assuming the correlation can be explained.

B.

Mar 13 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Páll Ólafsson | last post by:
Hi gurus... Well my problem might be simple to some of you but I can't figure it out. Im trying to export Report to pdf in code but I still getting the same error; "The process cannot access...
2
by: Andrea | last post by:
I'm having some difficulty creating a report in Access and I need some suggestions. My company issues "Return Authorizations" when customers need to return products. A customer calls in and we...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
12
by: enak | last post by:
I have found some code that shows how to convert an html form to Word. The message said to simply put the following in the Page_load: Response.ContentType = "application/ms-word"...
5
by: John | last post by:
I have 2 tables, one with dates and information about those dates, and one with people information. I want to create a report listing each date and the people who attended on that date (who have...
3
by: Tyranno.Lex | last post by:
I am using Visual Studio .NET 2003 and have successfully deployed a commercial web application written in C# and ASP.NET. I am now wanting to add reporting using Crystal Reports and am having a...
3
by: erick-flores | last post by:
Hello all I am creating an Expense Report. There are to types of expenses: Company expenses and Reimb Expeneses. The company expenses is under "Expense Details Co" table and Reimb Expenses is...
5
by: KewlToyZ | last post by:
Good day, I am stuck in a strange situation. SQL 2000 Server, creating a stored procedure to use in Crystal Reports 11. I am trying to build a report without creating a table or temprorary table in...
2
by: Andy | last post by:
Hi guys I having a problem creating a report in Access 2003 project talking to a SQL database through and ODBC connect. After hours of trying things from Access Help, MSDN and Google I still...
4
by: sklett | last post by:
I've developed an ERP application that we use internally and works quite well. I receiving more and more requests from users to print various transactions, order forms, search results, etc. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.