Access 2010 Union Query Truncating problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hom2013
    New Member
    • Jun 2013
    • 1

    #1

    Access 2010 Union Query Truncating problem

    HI,

    I'm having trouble with my SQL code truncating memo fields in my union query. Here is the code:

    Code:
    SELECT Projects.[11-14_Number] AS Expr1
       , Input2012 AS 2012Input
       , [Federal_9-12] AS Famt
       , [Copy of 11-14 TIP Status Project List Report for all years Query].[Local_9-12] AS Lamt
       , [Project Funding].Project_Funding AS F
       , [Project Sponsor].Project_Sponsor AS S
       , Projects.ProjectName as Name
       , [FirstOfProject_Status_9-12] AS Status
    FROM [Copy of 11-14 TIP Status Project List Report for all years Query]
    WHERE Input2012=yes
    UNION ALL SELECT Projects.[11-14_Number] AS Expr1
       , Input2011 AS 2011Input
       , [Copy of 11-14 TIP Status Project List Report for all years Query].[9-12_Federal_2011] AS Famt
       , [9-12_Local_2011] AS Lamt
       , [Project Funding].Project_Funding AS F
       , [Project Sponsor].Project_Sponsor AS S
       , Projects.ProjectName as Name
       , [FirstOfProject_Status_9_11] AS Status
    FROM [Copy of 11-14 TIP Status Project List Report for all years Query]
    WHERE Input2011=yes;

    The project status field gets truncated.
    Last edited by zmbd; Jul 2 '13, 03:34 PM. Reason: [Z{Please use the [CODE/] button to format posted code/html/sql - Please read the FAQ}{Stepped the SQL for easier read}]
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Moved your thread to the Access forum... SQL and Access-SQL can be very different beasties :)

    You really should try to use shorter names for queries, tables, fields, etc...

    You should not use any of the reserved words such as "Name" for a field name, nor should you use any of the other non-alphanumerics as they can and will cause you issues: Access 2007 reserved words and symbols

    You have not indicated which field is(are) your memo field(s).

    You have not indicated which version of Access you are using.

    You have not indicated what it is that you are trying to do with the query; however, the following may give you the reason:
    Allen Browne - Truncation of Memo fields

    In Access tables, Text fields are limited to 255 characters, but Memo fields can handle 64,000 characters (about 8 pages of single-spaced text) - even more programmaticall y. So why do memo fields sometimes get cut off?

    Queries
    Access truncates the memo if you ask it to process the data based on the memo: aggregating, de-duplicating, formatting, and so on.

    Here are the most common causes, and how to avoid them:
    (...)
    UNION query:
    • A UNION query combines values from different tables, and de-duplicates them. This means a comparing the memo field, resulting in truncation.
    • In SQL View, replace UNION with UNION ALL.
    (...)
    Last edited by zmbd; Jul 2 '13, 03:46 PM.

    Comment

    Working...