访问联合查询已截断备注字段
Access Union Query has truncated memo field
我有一个 Access UNION 查询,它基于三个子查询,每个子查询都有一个包含长文本的备注字段。
为了使三个子查询正常工作(即显示完整的备注字段文本),我已经使用了 Allen Brown (http://allenbrowne.com/ser-63.html) 推荐的变通解决方案 (First)。但是,当我使用 UNION 时,这些似乎不起作用。文本再次被截断为 255 个字符。
如何让一个查询显示包含来自我的三个子查询的所有记录的全文?
这是我当前的查询:
FROM _qry_publfinder_cb_other_advagreementno
UNION ALL
SELECT *
FROM _qry_publfinder_cb_other_advagreementyes
UNION ALL
SELECT *
FROM _qry_PublFinder_CB_Rec;```
这似乎是一个记录 'feature':
https://answers.microsoft.com/en-us/msoffice/forum/all/union-query-truncates-the-field-contents-of-memo/f81ee760-ec69-4b5b-a709-6e533f8f66de
A UNION query removes all duplicate records. Since a Memo field could
contain billions of bytes, the developers chose to avoid the possibly
very time consuming task of comparing one billion byte memo field to
another billion byte memo field by truncating all memos to 255 bytes.
If you don't need to deduplicate the records - i.e. if you're
confident that the records in the different tables are already
different - just use
UNION ALL
instead of UNION in the query. It won't try to deduplicate, it won't
truncate, and as a bonus the query will run faster.
如果包含您的备注字段的所有三个子查询共有一个 table,请尝试在完成并集后将其链接,例如
SELECT UQ.FLD1, UQ.FLD2, UQ.FLD3, tbl_with_memos.memo_field
FROM
(SELECT FLD1, FLD2, FLD3
FROM _qry_publfinder_cb_other_advagreementno
UNION ALL
SELECT SELECT FLD1, FLD2, FLD3
FROM _qry_publfinder_cb_other_advagreementyes
UNION ALL
SELECT SELECT FLD1, FLD2, FLD3
FROM _qry_PublFinder_CB_Rec) AS UQ
INNER JOIN tbl_with_memos
ON UQ.FLD1 = tbl_with_memos.FLD1
我选择为这种特殊情况创建一个解决方法。由于在任何情况下脚本都会调用最终查询,因此我创建了一个临时 table 将附加 3 个子查询。这样便不会截断备注字段。这当然是第二好的解决方案,但它确实有效。
DoCmd.Hourglass True
CurrentDb.Execute "qry_del_temp_PublFinder_CB"
CurrentDb.Execute "qry_app_PublFinder_CB_1"
CurrentDb.Execute "qry_app_PublFinder_CB_2"
CurrentDb.Execute "qry_app_PublFinder_CB_3"
DoCmd.OpenQuery "qry_PublFinderUpload", acViewNormal
DoCmd.Hourglass False
我有一个 Access UNION 查询,它基于三个子查询,每个子查询都有一个包含长文本的备注字段。
为了使三个子查询正常工作(即显示完整的备注字段文本),我已经使用了 Allen Brown (http://allenbrowne.com/ser-63.html) 推荐的变通解决方案 (First)。但是,当我使用 UNION 时,这些似乎不起作用。文本再次被截断为 255 个字符。
如何让一个查询显示包含来自我的三个子查询的所有记录的全文?
这是我当前的查询:
FROM _qry_publfinder_cb_other_advagreementno
UNION ALL
SELECT *
FROM _qry_publfinder_cb_other_advagreementyes
UNION ALL
SELECT *
FROM _qry_PublFinder_CB_Rec;```
这似乎是一个记录 'feature':
https://answers.microsoft.com/en-us/msoffice/forum/all/union-query-truncates-the-field-contents-of-memo/f81ee760-ec69-4b5b-a709-6e533f8f66de
A UNION query removes all duplicate records. Since a Memo field could contain billions of bytes, the developers chose to avoid the possibly very time consuming task of comparing one billion byte memo field to another billion byte memo field by truncating all memos to 255 bytes.
If you don't need to deduplicate the records - i.e. if you're confident that the records in the different tables are already different - just use
UNION ALL
instead of UNION in the query. It won't try to deduplicate, it won't truncate, and as a bonus the query will run faster.
如果包含您的备注字段的所有三个子查询共有一个 table,请尝试在完成并集后将其链接,例如
SELECT UQ.FLD1, UQ.FLD2, UQ.FLD3, tbl_with_memos.memo_field
FROM
(SELECT FLD1, FLD2, FLD3
FROM _qry_publfinder_cb_other_advagreementno
UNION ALL
SELECT SELECT FLD1, FLD2, FLD3
FROM _qry_publfinder_cb_other_advagreementyes
UNION ALL
SELECT SELECT FLD1, FLD2, FLD3
FROM _qry_PublFinder_CB_Rec) AS UQ
INNER JOIN tbl_with_memos
ON UQ.FLD1 = tbl_with_memos.FLD1
我选择为这种特殊情况创建一个解决方法。由于在任何情况下脚本都会调用最终查询,因此我创建了一个临时 table 将附加 3 个子查询。这样便不会截断备注字段。这当然是第二好的解决方案,但它确实有效。
DoCmd.Hourglass True
CurrentDb.Execute "qry_del_temp_PublFinder_CB"
CurrentDb.Execute "qry_app_PublFinder_CB_1"
CurrentDb.Execute "qry_app_PublFinder_CB_2"
CurrentDb.Execute "qry_app_PublFinder_CB_3"
DoCmd.OpenQuery "qry_PublFinderUpload", acViewNormal
DoCmd.Hourglass False