WITH A AS(
SELECT 
FONT,
FONTSIZE,
SAVENAMETITEL,
Q01.XTXT11 AS XTXT11_FONT,
CAST(Q01.XTXT12 AS DECIMAL) AS XTXT12_FONTSIZE,
CAST(Q01.XTXT9 AS DECIMAL) AS XTXT9_SAVENAMETITEL
FROM LD0P0T41 T41
JOIN LD0P0Q01 Q01
ON T41.DOKTYP=Q01.KOD
AND Q01.KODTYP='TYPDOK'
WHERE LIFECARE_CREATED=1
AND Q01.XTXT11<>' '
AND Q01.XTXT12<>' '
AND Q01.XTXT9<>' ')
UPDATE A SET FONT=XTXT11_FONT,FONTSIZE=XTXT12_FONTSIZE,SAVENAMETITEL=XTXT9_SAVENAMETITEL
;

WITH B AS(
SELECT 
FONT,
FONTSIZE,
SAVENAMETITEL,
Q01.XTXT2 AS XTXT2_FONT,
Q01.XNUM16 AS XNUM16_FONTSIZE,
Q01.XNUM14 AS XNUM14_SAVENAMETITEL
FROM LD0P0T41 T41
JOIN LD0P0Q01 Q01
ON T41.ANTDOKTYP=Q01.KOD
AND Q01.KODTYP='ANTTYP'
WHERE LIFECARE_CREATED=1)
UPDATE B SET FONT=XTXT2_FONT,FONTSIZE=XNUM16_FONTSIZE,SAVENAMETITEL=XNUM14_SAVENAMETITEL
;

WITH C AS(
SELECT 
FONT,
FONTSIZE,
SAVENAMETITEL,
Q01.XTXT1 AS XTXT1_FONT,
Q01.XNUM7 AS XNUM7_FONTSIZE,
Q01.XNUM6 AS XNUM6_SAVENAMETITEL
FROM LD0P0T41 T41
JOIN LD0P0Q01 Q01
ON T41.ANTECKNTYP=Q01.KOD
AND Q01.KODTYP='ANTECKNTYP'
WHERE LIFECARE_CREATED=1)
UPDATE C SET FONT=XTXT1_FONT,FONTSIZE=XNUM7_FONTSIZE,SAVENAMETITEL=XNUM6_SAVENAMETITEL
;