Wednesday, October 2, 2013

Create Netezza TIMESTAMP with fractional seconds



Observe, the timestamp mask definition: "... hh24:mi:ss.MS" and "...hh24:mi:ss.US"

--- Testing timestamps with fractional seconds at Netezza ---
create table xxxtab (test_name varchar(30),the_timestamp timestamp);

insert into xxxtab values('current_timestamp',current_timestamp);

insert into xxxtab values('converted timestamp',to_timestamp('2013-01-01 00:01:59','YYYY-MM-DD HH24:MI:SS'));

insert into xxxtab values('with mili seconds',to_timestamp('2013-01-01 00:01:59.999','YYYY-MM-DD HH24:MI:SS.MS'));

insert into xxxtab values('with micro seconds',to_timestamp('2013-01-01 00:01:59.99999','YYYY-MM-DD HH24:MI:SS.US'));

SELECT test_name, to_CHAR(the_timestamp,'YYYY-MM-DD HH24:MI:SS.US'from xxxtab order by createxid;




Friday, May 13, 2011

Save Range as Picture File. Simple solution.


PROBLEM:

How to save Excel range into image file. VBA macro in Excel 2007.

SOLUTION:
Create an empty chart, paste range image into chart area, and Export as image file.

''' Set Range you want to export to file
Dim rgExp As Range: Set rgExp = Range("B5:H14")
''' Copy range as picture onto Clipboard
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
''' Create an empty chart with exact size of range copied
With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
Width:=rgExp.Width, Height:=rgExp.Height)
.Name = "ChartVolumeMetricsDevEXPORT"
.Activate
End With
''' Paste into chart area, export to file, delete chart.
ActiveChart.Paste
ActiveSheet.ChartObjects("ChartVolumeMetricsDevEXPORT").Chart.Export "C:\testmeExportChart.jpg"
ActiveSheet.ChartObjects("ChartVolumeMetricsDevEXPORT").Delete

Modify code to suite to your needs.