473,382 Members | 1,639 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,382 software developers and data experts.

DB2 query hours difference

i need ur help.

i want to have CPU utilization of last 24 hrs. for time being i want
to have result from 1 server.

select "AVG_%_Total_Processor_Time", "WRITETIME", "MAX_
%_Total_Processor_Time", "MIN_%_Total_Processor_Time", "AVG_
%_Total_Privileged_Time" , "AVG_%_Total_User_Time",
"AVG_Context_Switches/Sec", "AVG_Total_Interrupts/Sec"
from "NT_System_HV"
where "Server_Name" = 'Primary:ITM6VM:NT' and "WRITETIME" between
'0000000000000000' and'9999999999999999'

query working fine till where server name but i am confuse how to
utilize and get result from between clause and get last 24 hrs result.

i want this query for BIRT report design and itm6.2.
pls tell me how to achieve the result.
Jun 27 '08 #1
5 9190
What is the data type(and format, if data type is not TIMESTAMP) of
"WRITETIME"?

If the data type is TIMESTAMP, this might be an answer:
"WRITETIME" between CURRENT TIMESTAMP - 24 HOURs
and CURRENT TIMESTAMP

By the way, waht is "BIRT report design and itm6.2"?
Jun 27 '08 #2
On Jun 20, 9:31*pm, Tonkuma <tonk...@fiberbit.netwrote:
What is the data type(and format, if data type is not TIMESTAMP) of
"WRITETIME"?

If the data type is TIMESTAMP, this might be an answer:
"WRITETIME" between CURRENT TIMESTAMP - 24 HOURs
* * * * * * * * and CURRENT TIMESTAMP

By the way, waht is "BIRT report design and itm6.2"?
thanks for ur reply . data type of "WRITETIME" is 16 character. data
is store like that 1082106400000000.

BIRT is open source tool for report designing. and itm is ibm product
for system health monitoring.

pls provide the query . thanks
Jun 27 '08 #3
data type of "WRITETIME" is 16 character.
data is store like that 1082106400000000.
How to interprit this 16 character string?
It looks like not including yyyy,mm,dd, so on.
It may be time duration.
If so, from when and what is a timeunit(miliseconds? microseconds? or
other?) of the duration?
Jun 27 '08 #4
On Jun 23, 8:34 am, Irfan Mughal <iffi....@gmail.comwrote:
[...]
thanks for ur reply . data type of "WRITETIME" is 16 character. data
is store like that 1082106400000000.
What is it, microseconds since 1970-01-01 00:00:00 UTC? In that case,
how about:

select ... from ... where timestamp('1970-01-01-00.00.00.0') +
(1082106400000000 / 1000000) seconds (current_timestamp - 24 hours)

/Lennart

[...]
Jun 27 '08 #5
Lennart wrote:
On Jun 23, 8:34 am, Irfan Mughal <iffi....@gmail.comwrote:
[...]
>thanks for ur reply . data type of "WRITETIME" is 16 character. data
is store like that 1082106400000000.

What is it, microseconds since 1970-01-01 00:00:00 UTC? In that case,
how about:

select ... from ... where timestamp('1970-01-01-00.00.00.0') +
(1082106400000000 / 1000000) seconds (current_timestamp - 24 hours)

/Lennart

[...]
It is a typical format for Tivoli, I guess, and definitely not "microseconds
since ..."
The example given by OP seems to be not valid, however (see below).

I found the following Redbook "Tivoli Management Services Warehouse and
Reporting":
http://www.redbooks.ibm.com/redbooks/pdfs/sg247290.pdf
which should be useful for OP. Be aware, though, it is a 9Mb download.
Here is some relevant snippets form a chapter on using Crystal Reports:

------------------------------
[Page 459:]
7.2.5 Report creation: Disk Usage
In this section, we create a sample report titled Disk Usage.
<description of some steps from the Crystal Reports wizard>
------------------------------

------------------------------
[Page 461, step 3 from the wizard:]
3. Select the grouping. In this case, we want the data to be grouped by
System_Name, by LAT_Mount_Point, and then by WRITETIME, as shown in Figure
7-36.
We also have to convert the WRITETIME field to a readable format. We do this
later when we finish this wizard.
------------------------------

------------------------------
[Page 463, step 5 from the wizard:]
5. At this point, we create an SQL Expression Field to convert WRITETIME to
a readable format.
To convert WRITETIME field, see "Converting TIMESTAMP field" on page 448.
------------------------------

------------------------------
[Page 449/450, the relevant part of above mentioned paragraph:]
3. Select SQL Expression Fields and enter an SQL that:
a. Converts the string field TIMESTAMP into a human-readable format string

You can use the following sample syntax to convert the TIMESTAMP field into
a readable format. This syntax translate the TIMESTAMP field to a
human-readable format:

From: 1061024164012000

To: 20061024:1640:12000

'20' || substr("Linux_CPU"."Timestamp",2,6) || ':' ||
substr("Linux_CPU"."Timestamp",8,4) || ':' ||
substr("Linux_CPU"."Timestamp",12,5)

b. Converts the string field TIMESTAMP into a datetime

You can use the following sample syntax to convert the TIMESTAMP field into
datetime format. This syntax translate the TIMESTAMP field to datetime
format:

From: 1061024164012000

To: 20061024164012 (System default: "10/24/2006 4:40:12PM")

timestamp('20' || substr("Linux_CPU"."Timestamp",2,6) ||
substr("Linux_CPU"."Timestamp",8,6) )

<...>
------------------------------

The format therefor seems to be CYYMMDDHHMMSSmmm
(C=Century-bit: 0=19, 1=20)

HTH

--
Jeroen
Jun 27 '08 #6

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

Similar topics

3
by: Shaun | last post by:
Hi, I have a table called Bookings which has two important columns; Booking_Start_Date and Booking_End_Date. These columns are both of type DATETIME. The following query calculates how many...
1
by: mark | last post by:
I'm stuck: In a query I am trying to compare two fields with a date/time data type and a LongTime format to get the difference in hours (minutes and seconds if possible). After that I need to...
4
by: ED | last post by:
I am attempting to to write a query that has a numerous nested IIf statements. The problem that I am having is that it is to long of a query to be built in design mode and when I build it in sql...
3
by: Jamie Pittman via AccessMonster.com | last post by:
I am having trouble bellow wit this query. I have the total regular hours and the overtime. The problem is that if it is 8 hours and under, I need it to show as regular hours. Any thoughts? ...
5
by: ????? | last post by:
I have an access query which gets data from a number of different tables. Although the tables have primary key fields, the order in which the records are returned means that none of these are in...
4
by: Stephen Young | last post by:
Hello Have a bit of a problem, im trying to get the total number of hours:minutes for all actions over the month in a query, have tried two methods to no luck... Duration This Month:...
1
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I...
30
by: Noob | last post by:
ftp://ukcassassin:winston@www.ukcassassin.pwp.blueyonder.co.uk/htdocs/Diary%20Form.bmp Hi all I will appologise in advance for my lack of knowledge of access and its working as i am quite new to...
3
by: tcveltma | last post by:
Hi Everyone, I know there's been a lot of questions regarding the same kind of issue but I haven't been able to find an answer to my specific problem. Basically I have two tables, one table...
7
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.