Union Query Error (1 Viewer)

Tor_Fey

Registered User.
Local time
Today, 21:43
Joined
Feb 8, 2013
Messages
121
Afternoon all;

I am running the following union query which has been working until today:

SELECT sund_main_ref AS REF,sund_main_folio AS FOLIO, "SUND" AS SUFFIX,sund_main_comment AS COMMENT
FROM tbl_sund_main
UNION ALL SELECT m_ref,m_folio,"POST" AS SUFFIX,m_declared_contents
FROM tbl_postcharge_main
UNION ALL SELECT occ_main_ref,occ_main_folio,"OCC" AS SUFFIX,occ_uk_comment
FROM tbl_OCC_main
UNION ALL SELECT rep_ref,rep_trader,"REPAY" AS SUFFIX,rep_comments
FROM tbl_repay
UNION ALL SELECT C18_ID,C18_folio,"C18" AS SUFFIX,C18_agents_ref
FROM tbl_C18
UNION ALL SELECT seq,folio,"CARS" AS SUFFIX,make&": "&model
FROM tbl_details_cars;

Unfortunately today for some reason it is showing the following error:

'The width of a Unicode text column must be an even number of bytes'

Could anyone shed some light on this error? I have already carried out a compact and repair on this database, and all the tables mentioned in the above sql query open without fault. :banghead:

Regards
Tor Fey
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:43
Joined
Feb 19, 2013
Messages
16,612
have you tried removing a union at a time from the query to isolate which table is causing the problem?
 

plog

Banishment Pending
Local time
Today, 15:43
Joined
May 11, 2011
Messages
11,646
My guess is its the last field of the last SELECT:

Code:
...

What are you trying to do there? Concatenate? If so, you need spaces before and after those ampersands.
 

plog

Banishment Pending
Local time
Today, 15:43
Joined
May 11, 2011
Messages
11,646
Weird. I tried to post the SQL of that last SELECT and it wouldn't except it. I removed the code and resubmitted and it did.

make&": "&model

Seems to break more than just SQL
 

Tor_Fey

Registered User.
Local time
Today, 21:43
Joined
Feb 8, 2013
Messages
121
cj_london/plog

I managed to identify a corrupt record in the tbl_details_cars, I have removed the record and everything is fine now. :D

Although; I had to copy the table and structure in order to remove the record, and then delete the original.

Thanks for your help.

Kind Regards
Tor Fey
 

sneuberg

AWF VIP
Local time
Today, 13:43
Joined
Oct 17, 2014
Messages
3,506
The fact that this was working and the error point to a problem with the data. I suggest make a copy of the database to test and then start deleting the most resent data until the problem clears up. I suggest a divide and conquer strategy.
 

Users who are viewing this thread

Top Bottom