Hi all According to the help: This error is generated when sort key truncation is about to occur, typically during GROUP BY, ORDER BY or other sorting operations. This can happen with use of a sort key that contains an expression, such as a Memo field, whose length is not fixed.
The problem manifests itself when executing the following SQL (sorry about the length of the statement): Select Str(Nh_Year,4,0) + Str(Nh_Period,2,0)+ Transform(NH_YEAR) + Transform(NH_NACNT) + Transform(NH_PERIOD) As Key, ; Nh_Year, Nh_Period,Str(Nh_Year,4,0) + '/' + Str(Nh_Period,2,0) As YearPeriod,Nh_NType, Nh_NSubt, Nh_Nacnt, Nh_NCntr, ; Nh_Job, Nh_Project, Sum(Nh_PtdDr) As Nh_PtdDr, -1 * Sum(Nh_PtdCr) As Nh_PtdCr, Sum(Nh_Bal) As Nh_Bal,Sum(NH_BUDG) As Nh_Budg, ; 999999999999.99 As Variance, 999999999999.99 As YTDBal, 999999999999.99 As YTDBudg, 999999999999.99 As YTDVar ; >From NHist Where NH_YEAR >= 2019 And NH_YEAR <= 2019 And NH_PERIOD >= 1 And >NH_PERIOD <= 3 And NH_YEAR = 2019 ; And NH_NACNT = 'A110 ' And NH_PERIOD = 1 And Nh_RecType = 1 ; Group By Key Union Select Str(Nh_Year,4,0) + Str(Nh_Period,2,0)+ Transform(NH_YEAR) + Transform(NH_NACNT) + Transform(NH_PERIOD) As Key, ; Nh_Year, Nh_Period,Str(Nh_Year,4,0) + '/' + Str(Nh_Period,2,0) As YearPeriod,; Nh_NType, Nh_NSubt, Nh_Nacnt, Nh_NCntr, Nh_Job, Nh_Project, Sum(Nh_PtdDr) As Nh_PtdDr, -1 * Sum(Nh_PtdCr) As Nh_PtdCr, ; Sum(Nh_Bal) As Nh_Bal,Sum(NH_BUDG) As Nh_Budg, 999999999999.99 As Variance, 999999999999.99 As YTDBal, ; 999999999999.99 As YTDBudg, 999999999999.99 As YTDVar From NHist Where NH_YEAR >= 2019 And NH_YEAR <= 2019 ; And NH_PERIOD >= 1 And NH_PERIOD <= 3 And NH_NACNT = 'A110 ' And Empty(NH_JOB) And Empty(NH_PROJECT) ; And Empty(NH_NCNTR) And Inlist(Nh_RecType,2,3) Group By Key InTo Cursor _5F50SKUYV Now I know this is a fairly complex query but it does not contain any columns whose length is not fixed. I wonder if anybody has come across this error before. I have had to resort to completely rewriting the code that generates the SQL statement. Many thanks Paul Newton _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/mn2pr02mb5920bfc0d1de60998c653f83a1...@mn2pr02mb5920.namprd02.prod.outlook.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

