Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String to long to fit - limit on aggregate functions ?
Message
From
21/07/2007 19:42:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/07/2007 17:29:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01242567
Message ID:
01242576
Views:
18
This message has been marked as the solution to the initial question of the thread.
>Okay, I'm stumped. A collegue send me a prg which evidently works for him but when I run it ( 2gb duo core XP sp2 VFP9 sp1 ) after it blows through some pretty complex ( and very long ) SQL statements it hits this one and blows out on a "String too long to fit" error
>
>
>*= Create a summary cursor for each coverage.
>SELECT ;
> Pol_cKey ;
> ,MAX(Pol_cPolicyNo) AS Pol_cPolicyNo ;
> ,MAX(Pol_cFileNo) AS Pol_cFileNo ;
> ,MAX(Pol_cQuoteNum) AS Pol_cQuoteNum ;
> ,MAX(Pol_dBound) AS Pol_dBound ;
> ,MAX(Pol_nDues) AS Pol_nDues ;
> ,MAX(Pol_nCommRate) AS Pol_nCommRate ;
> ,MAX(Pol_nMaxRateMod) AS Pol_nMaxRateMod ;
> ,MAX(Pol_nDiscountMaxRateOverage) AS Pol_nDiscountMaxRateOverage ;
> ,MAX(Pol_nPremium) AS Pol_nPremium ;
> ,MAX(Pol_nMinPrem) AS Pol_nMinPrem ;
> ,MAX(Pol_nPremiumTax) AS Pol_nPremiumTax ;
> ,MAX(Pol_nPerilPrem) AS Pol_nPerilPrem ;
> ,MAX(Pol_nMinCharge) AS Pol_nMinCharge ;
> ,MAX(Pol_nMinChgDef) AS Pol_nMinChgDef ;
> ,MAX(Pol_nPolicyFee) AS Pol_nPolicyFee ;
> ,MAX(Pol_nPolicyFeeTax) AS Pol_nPolicyFeeTax ;
> ,MAX(Pol_ntfDecimal) AS Pol_ntfDecimal ;
> ,MAX(Pol_nMinTermFactor) AS Pol_nMinTermFactor ;
> ,End_cKey ;
> ,MAX(End_cQuoteNum) AS End_cQuoteNum ;
> ,MAX(End_dQuoteDate) AS End_dQuoteDate ;
> ,MAX(End_dBound) AS End_dBound ;
> ,MAX(End_dDate) AS End_dDate ;
> ,MAX(End_EffectiveDate) AS End_EffectiveDate ;
> ,MAX(End_EffectiveTime) AS End_EffectiveTime ;
> ,MAX(End_tEffectiveDateTime) AS End_tEffectiveDateTime ;
> ,MAX(End_ntfDecimal) AS End_ntfDecimal ;
> ,CAST(MAX(ALLTRIM(End_mScript)) AS Memo) AS End_mScript ;
> ,Cov_cKey ;
> ,MAX(Coverage) AS Coverage ;
> ,MAX(Cov_nMaxRateMod) AS Cov_nMaxRateMod ;
> ,MAX(Cov_nDiscountMaxRateOverage) AS Cov_nDiscountMaxRateOverage ;
> ,MAX(Cov_Discount) AS Cov_Discount ;
> ,MAX(CovDisc_nIsPolicyDiscount) AS CovDisc_nIsPolicyDiscount ;
> ,MAX(CovDisc_nDiscount) AS CovDisc_nDiscount ;
> ,MAX(CovDisc_nRateModPer) AS CovDisc_nRateModPer ;
> ,MAX(CovDisc_nRateModAmt) AS CovDisc_nRateModAmt ;
> ,MAX(Cov_TotCovPerPrem) AS Cov_TotCovPerPrem ;
> ,MAX(Cov_PerMinChgDef) AS Cov_PerMinChgDef ;
> ,CAST(MAX(ALLTRIM(Cov_ExtraCostPerils)) AS Memo) AS Cov_ExtraCostPerils ;
> ,MAX(Cov_TotCovHazDis) AS Cov_TotCovHazDis ;
> ,CAST(MAX(ALLTRIM(Cov_HazardDiscountsApplied)) AS Memo) AS Cov_HazardDiscountsApplied ;
> ,CAST(NULL AS Memo) AS HazardList ;
> ,CAST(MAX(LEN(ALLTRIM(Hazard))) AS INTEGER) AS MaxHazardLen ;
> ,CAST(MAX(LEN(ALLTRIM(ChildHazard))) AS INTEGER) AS MaxChildHazardLen ;
> ,SUM(PremiumB4Discounts) ;
> AS TotalPremiumB4Discounts ;
> ,SUM(PremiumB4Discounts) ;
> - SUM(EffectivePremium) ;
> AS TotalHazardDiscounts ;
> ,SUM(EffectivePremium) ;
> AS TotalHazardPremium ;
>INTO CURSOR PolEndCovSummary ;
>FROM DetailPolEndCovHazDiscountedPremiums ;
>GROUP BY ;
> Pol_cKey ;
> ,End_cKey ;
> ,Cov_cKey ;
>ORDER BY 31 ; && Coverage
>READWRITE
>

>
>Enginebehavior is set to 70. I left the order of the INTO and FROM clauses just as he has it ( though I didn't know you could do that - looks like LINQ ) though I have tried switching them with the same result.
>
>If I reduce the agg functions by about half it works.
>
>Would very much appreciate any thoughts. ( I'll be talking with him Sunday, but have every reason to believe this runs for him )
>
>TIA

Hey Charles,
I don't think you could max() on memo columns. Remove the one that comes from a memo.
Why do you need such a strange SQL. Do you think the result would really be meaningfull if it worked? Date and time especially sounds to be suspicious.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform