Period SQL to Binary C type Conversion - ODBC Driver for Teradata - 16.20

ODBC Driver for Teradata® User Guide

prodname
ODBC Driver for Teradata
vrm_release
16.20
category
User Guide
featnum
B035-2526-108K

The following table shows the format of returned data when retrieving it in a binary format.

Period Data Type Number of Bytes Members Passed Members Detail (in the order specified)
PERIOD(DATE) 8 2 DATE members Date: 4-byte, signed integer. This integer represents a date in the same manner as for a DATE data type (for example, 10000*(year-1900)) + (100*month) + day)
PERIOD(TIME(n)) 12 2 TIME members Second: 4-byte, signed integer. This integer represents the number of seconds scaled by 10**6 (for example, 12.56 seconds is returned as 12560000).

Hour: 1 unsigned byte. This byte represents the number of hours.

Minute: 1 unsigned byte to client form. This byte represents the number of minutes.

PERIOD(TIME(n) WITH TIME ZONE) 16 2 TIME WITH TIME ZONE members Second: 4-byte, signed integer. This integer represents the number of seconds scaled by 10**6 (for example, 12.56 seconds is returned as 12560000).

Hour: 1 unsigned byte. This byte represents the number of hours.

Minute: 1 unsigned byte. This byte represents the number of minutes.

Time Zone Hour: 1 unsigned byte. This byte represents the hours portion of the time zone displacement, along with whether the displacement is positive or negative. A value of 16 represents 0 hours. A value less than 16 represents a negative time zone displacement for the specified hours; for example, if this is 10, the time zone is displaced by -10 hours. If the value is greater than 16, it specifies a positive time zone displacement of (Time Zone Hour - 16) hours; that is, a value of 20 implies a +4 hour displacement.)

Time Zone Minute: 1 unsigned byte. This byte represents the minutes portion of the time zone displacement.

PERIOD(TIMESTAMP(n)) 20 2 TIMESTAMP members Two TIMESTAMP members containing:

Second: 4-byte, signed integer. This integer represents the number of seconds scaled by 10**6 (for example, 12.56 seconds is returned as 12560000).

Year: 2-byte, signed short integer. This byte represents the year value.

Month: 1 unsigned byte. This byte represents the month value.

Day: 1 unsigned byte. This byte represents the day of the month.

Hour: 1 unsigned byte. This byte represents the number of hours.

Minute: 1 unsigned byte. This byte represents the number of minutes.

PERIOD(TIMESTAMP(n) WITH TIME ZONE) 24 2 TIMESTAMP WITH TIME ZONE members Two TIMESTAMP members containing:

Second: 4-byte, signed integer. This integer represents the number of seconds scaled by 10**6 (for example, 12.56 seconds is returned as 12560000).

Year: 2-byte, signed short integer. This byte represents the year value.

Month: 1 unsigned byte. This byte represents the month value.

Day: 1 unsigned byte. This byte represents the day of the month.

Hour: 1 unsigned byte. This byte represents the number of hours.

Minute: 1 unsigned byte. This byte represents the number of minutes.

Time Zone Hour: 1 unsigned byte. This byte represents the time zone displacement in hours, along with whether the displacement is positive or negative. A value of 16 represents 0 hours. A value less than 16 represents a negative time zone displacement for the specified hours; for example, if this value is 10, the time zone is displaced by -10 hours. If the value is greater than 16, it specifies a positive time zone displacement of (Time Zone Hour - 16) hours; that is, a value of 20 implies a +4 hour displacement.)

Time Zone Minute: 1 unsigned byte. This byte represents the minutes portion of the time zone displacement.

Any target precision set by the application in the application record descriptor is ignored by the driver. The Second values returned by the database are always 4-byte signed integers with the seconds scaled by 10**6. The precision of the source data is available through SQLDescribeCol/SQLColAttribute or directly in the Implementation Record Descriptor.