Thread: ODBC issue with aggregate fields (SUM)
We do the following test on the client site :
A)Using SQLExecDirect with this query
------------
SELECT SUM("str_sls_totals"."strsl_net_dly"), "dw_trans_type"."trans_type", "flash_dates"."year_number", "flash_dates"."month_number", "flash_dates"."day"
FROM "dw_trans_type", "str_sls_totals", "flash_dates"
WHERE ("flash_dates"."dt" = "str_sls_totals"."strsl_per_dt") AND
("dw_trans_type"."trans_type" = "str_sls_totals"."strsl_tran_type") AND
( NOT("str_sls_totals"."strsl_tran_type" IN (5,6)) ) AND
( "dw_trans_type"."trans_type" = 4 ) AND
( "flash_dates"."year_number" = 2005 ) AND
( "flash_dates"."month_number" = 8 ) AND
( "flash_dates"."day" = 13 )
GROUP BY "dw_trans_type"."trans_type", "flash_dates"."year_number", "flash_dates"."month_number", "flash_dates"."day"
------------
Extract the column size with SQLColAttributes
SQLColAttributes:
In: hstmt = 0x00992148, icol = 1,
fDescType = SQL_COLUMN_DISPLAY_SIZE=6, rgbDesc = -892679478,
cbDescMax = 300, pcbDesc = -13622,
pfDesc = 0x00152C90, Description Type = SQL_C_SLONG=-16
Return: SQL_SUCCESS=0
Out: *pfDesc = 20
------------
So the size of SUM("str_sls_totals"."strsl_net_dly") is 20. When we change the year to 2004 the size is returned as 30 ! ! ! Is this by design or a bug.
Postgres 7.3.4, ODBC driver 7.3.200.
Thanks for any input you have.
A)Using SQLExecDirect with this query
------------
SELECT SUM("str_sls_totals"."strsl_net_dly"), "dw_trans_type"."trans_type", "flash_dates"."year_number", "flash_dates"."month_number", "flash_dates"."day"
FROM "dw_trans_type", "str_sls_totals", "flash_dates"
WHERE ("flash_dates"."dt" = "str_sls_totals"."strsl_per_dt") AND
("dw_trans_type"."trans_type" = "str_sls_totals"."strsl_tran_type") AND
( NOT("str_sls_totals"."strsl_tran_type" IN (5,6)) ) AND
( "dw_trans_type"."trans_type" = 4 ) AND
( "flash_dates"."year_number" = 2005 ) AND
( "flash_dates"."month_number" = 8 ) AND
( "flash_dates"."day" = 13 )
GROUP BY "dw_trans_type"."trans_type", "flash_dates"."year_number", "flash_dates"."month_number", "flash_dates"."day"
------------
Extract the column size with SQLColAttributes
SQLColAttributes:
In: hstmt = 0x00992148, icol = 1,
fDescType = SQL_COLUMN_DISPLAY_SIZE=6, rgbDesc = -892679478,
cbDescMax = 300, pcbDesc = -13622,
pfDesc = 0x00152C90, Description Type = SQL_C_SLONG=-16
Return: SQL_SUCCESS=0
Out: *pfDesc = 20
------------
So the size of SUM("str_sls_totals"."strsl_net_dly") is 20. When we change the year to 2004 the size is returned as 30 ! ! ! Is this by design or a bug.
Postgres 7.3.4, ODBC driver 7.3.200.
Thanks for any input you have.
On Wed, Aug 10, 2005 at 10:08:20AM -0400, Tim Nelson wrote: > So the size of SUM("str_sls_totals"."strsl_net_dly") is 20. When we > change the year to 2004 the size is returned as 30 ! ! ! Is this by > design or a bug. What is the type of that column? I'm thinking, if it's numeric, then it's quite possible that two different amounts can have different sizes. -- Alvaro Herrera (<alvherre[a]alvh.no-ip.org>) "You're _really_ hosed if the person doing the hiring doesn't understand relational systems: you end up with a whole raft of programmers, none of whom has had a Date with the clue stick." (Andrew Sullivan)
The column is decimal(16,2). Thanks.