dbTalk Databases Forums  

SQL query changes field data type

comp.databases.paradox comp.databases.paradox


Discuss SQL query changes field data type in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rey
 
Posts: n/a

Default SQL query changes field data type - 02-10-2006 , 05:26 PM






Howdy all.
As part of a conversion project, converted the query on which a report is
based to SQL. When I attempt to open the report, I get the msg that the
ObjectPal version used in this form is incompatible with this version of
Paradox....

Found that the SQL version of query results in the UnitCount field being
changed from N to I. Is there anyway to correct this other than:
1. saving rpt under different name for the SQL query as the report is used
elsewhere in the application.
Or
2. Modifying the SQL query into an insert query using the original table.

Below are the respective queries.

Thanks in advance,
Rey

*****************************
AssnSummary = Query ; creates riv:statuna1.db

:PRIV:STATUN0B | UnitNumFK | AssnNumFK
Quote:
calc count as UnitCount | Check _join1,
as AssnNumPK |

:PRIV:STATUN0B | P1Bal | P2Bal |
P3Bal |
Quote:
calc sum as P1Bal | calc sum as P2Bal |
calc sum as P3Bal |

:PRIV:STATUN0B | TotBal |
Quote:
calc sum as TotBal |
:HAIDATA:ASSNMAST | AssnNumPK | AssnName | AssnAbrv |
Quote:
_join1 | Check
Check |
EndQuery
Tbl structure:
AssnNumPK A3
AssnName A50
AssnAbrv A25
UnitCount N
P1Bal N
P2Bal N
P3Bal N
TotBal N


SELECT DISTINCT S.AssnNumFK AssnNumPK, A.AssnName, A.AssnAbrv, COUNT(
DISTINCT S.UnitNumFK ) UnitCount, SUM( S.P1Bal ) P1Bal, SUM( S.P2Bal )
P2Bal, SUM( S.P3Bal ) P3Bal, SUM( S.TotBal ) TotBal
FROM STATUN0B S
INNER JOIN :HAIDATA:ASSNMAST A
ON (A.AssnNumPK = S.AssnNumFK)
GROUP BY S.AssnNumFK, A.AssnName, A.AssnAbrv
ORDER BY AssnNumPK, A.AssnName, A.AssnAbrv

Tbl structure:
AssnNumPK A3
AssnName A50
AssnAbrv A25
UnitCount I
P1Bal N
P2Bal N
P3Bal N
TotBal N






Reply With Quote
  #2  
Old   
Anders Jonsson
 
Posts: n/a

Default Re: SQL query changes field data type - 02-11-2006 , 02:20 AM






Quote:
Is there anyway to correct this other than:
If you are using local SQL you can use:

cast(count( DISTINCT S.UnitNumFK) as NUMERIC) as UnitCount

or you could try:

count( DISTINCT S.UnitNumFK) *1.0 as UnitCount


Anders





Reply With Quote
  #3  
Old   
Rey
 
Posts: n/a

Default Re: SQL query changes field data type - 02-13-2006 , 10:26 AM



Howdy Anders.
Thanks for the suggestion. Just this AM - when I couldn't get back to
sleep - I thought of using Cast. Will give it a try.

Thanks again,
Rey



Reply With Quote
  #4  
Old   
Anders Jonsson
 
Posts: n/a

Default Re: SQL query changes field data type - 02-13-2006 , 02:45 PM



Good luck, and don't worry, I also figure out many of my SQL statements in
bed! :-)

Anders


"Rey" <reycollazo (AT) cox (DOT) net> skrev i meddelandet
news:am2If.57715$V.22417 (AT) fed1read04 (DOT) ..
Quote:
Howdy Anders.
Thanks for the suggestion. Just this AM - when I couldn't get back to
sleep - I thought of using Cast. Will give it a try.

Thanks again,
Rey




Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.