If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > sum aggregated field divided by 100 when inserted into temp table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-24-09, 20:39
dimensiongod dimensiongod is offline
Registered User
 
Join Date: Nov 2009
Posts: 1
sum aggregated field divided by 100 when inserted into temp table

Hi,

I have been working for the last two hours trying to figure out why this was happening in Pervasive 8.

table employee (simplified table)

ID salary
A 100
A 100
A 100

simplified version of stored procedure

my stored proc:

select ID, sum(salary) Total from
employee
group by ID


The resultset from this stored proc returns:

ID Total
A 300



However, if I take this simplified stored proc and insert the results of that into a temp table before displaying,
it provides a resultset divided by exactly 100.


stored proc that divides by 100 incorrectly:

select ID, sum(salary) Total
into "#table1"
from employee
group by ID

select ID, TOTAL from "#table1"


Resultset is as follows:

ID Total
A 3.00


The example I'm providing is absolutely simplified and the stored proc actually does a lot more. But if I take the results and insert into a temp table before displaying the temp table contents, the results are always divided by 100.

has anyone else seen this problem?
Reply With Quote
  #2 (permalink)  
Old 11-24-09, 22:00
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
I've not heard of this behavior. What version of V8 are you using? Also, what tool are you using (PCC, ODBC Test, etc)? Do you see the behavior using ODBC Test? WHat's the data type of "salary"?
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #3 (permalink)  
Old 12-04-09, 19:30
BtrieveBill BtrieveBill is offline
Registered User
 
Join Date: Dec 2009
Posts: 1
I have seen this with some data types. Try patching to PSQLV8.7 (a free update) to see if that takes care of it. Be sure to patch both the client AND the server.

Another thing to try is cCASTing the value to an INTEGER first, which should eliminate the decimal point placement issue.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On