Saturday, March 8, 2008

ITM 6.1 DW Timestamps - What's Up?

So you have the new ITM 6.1 data warehouse up and your boss asks for his or her first report. You figure out how to run a simple query against the NT_Processor table and you produce your first report...

Server_Name Timestamp Processor %_Processor_Time
Primary:GBS301:NT 1060321090504996 0 30
Primary:GBS301:NT 1060321092110296 0 11
Primary:GBS301:NT 1060321093612593 0 8
Primary:GBS301:NT 1060321095110906 0 3

The first obvious question you will get is what the heck is 106032109950499. The wrong response would be to point him or her to this blog entry:

ITM 6.1 Datawarehouse Timestamps

A better answer would be to format the CTIME timestamp in your SQL into a readable date and time stamp as follows:

select
"Server_Name",
SUBSTR("Timestamp", 2, 2) || '-' ||
SUBSTR("Timestamp", 4, 2) || '-' ||
SUBSTR("Timestamp", 6, 2) || ' ' ||
SUBSTR("Timestamp", 8, 2) || ':' ||
SUBSTR("Timestamp", 10, 2) || ':' ||
SUBSTR("Timestamp", 12, 2),
"%_Processor_Time",
from ITMUSER."NT_Processor";

No comments: