ContactSageXref
Created by: Lester Caine, Last modification: 15 Oct 2010 (17:17 BST)
{code source=sql} INSERT INTO CONTACT_XREF SELECT NULL AS XREF_ID, s.CONTENT_ID, '#P' AS SOURCE, 1 AS XORDER, s.CONTENT_ID AS XREF, s.TELEPHONE AS XKEY, '' AS XKEY, NULL AS DATA, CURRENT_TIMESTAMP AS START_DATE, CURRENT_TIMESTAMP AS LAST_UPDATE_DATE, CURRENT_TIMESTAMP AS ENTRY_DATE, NULL AS END_DATE FROM CONTACT_SAGE s WHERE s.TELEPHONE <> '' INSERT INTO CONTACT_XREF SELECT NULL AS XREF_ID, s.CONTENT_ID, 'VAT_NO' AS SOURCE, 1 AS XORDER, s.CONTENT_ID AS XREF, s.VAT_REG_NUMBER AS XKEY, '' AS XKEY_EXT, NULL AS DATA, CURRENT_TIMESTAMP AS START_DATE, CURRENT_TIMESTAMP AS LAST_UPDATE_DATE, CURRENT_TIMESTAMP AS ENTRY_DATE, NULL AS END_DATE FROM CONTACT_SAGE s WHERE s.VAT_REG_NUMBER <> '' INSERT INTO CONTACT_XREF SELECT NULL AS XREF_ID, s.CONTENT_ID, 'ACC_TO' AS SOURCE, 2009 AS XORDER, s.CONTENT_ID AS XREF, s.TURNOVER_PRIOR AS XKEY, '' AS XKEY_EXT, NULL AS AS DATA, CURRENT_TIMESTAMP AS START_DATE, CURRENT_TIMESTAMP AS LAST_UPDATE_DATE, CURRENT_TIMESTAMP AS ENTRY_DATE, NULL AS END_DATE FROM CONTACT_SAGE s WHERE s.TURNOVER_PRIOR <> '' INSERT INTO CONTACT_XREF SELECT NULL AS XREF_ID, s.CONTENT_ID, '#F' AS SOURCE, 1 AS XORDER, s.CONTENT_ID AS XREF, s.FAX AS XKEY, '' AS XKEY_EXT, NULL AS DATA, CURRENT_TIMESTAMP AS START_DATE, CURRENT_TIMESTAMP AS LAST_UPDATE_DATE, CURRENT_TIMESTAMP AS ENTRY_DATE, NULL AS END_DATE FROM CONTACT_SAGE s WHERE s.FAX <> '';{/code}