Announcement

Collapse
No announcement yet.

where to put the semi-colon?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • where to put the semi-colon?

    I have a button to merge data from one table to another. The problem is the semi-colon....Can someone tell me where the semi-colon goes for this to work?
    sc_exec_sql(" MERGE Product_Structure as MAIN
    USING Product_Structure_[PMdate] as TEMP
    ON (MAIN.PARPRT_02 = TEMP.PARPRT_02 And MAIN.COMPRT_02 = TEMP.COMPRT_02)
    WHEN MATCHED THEN UPDATE
    SET MAIN.EFFDTE_02 = TEMP.EFFDTE_02,
    MAIN.FILL01_02 = TEMP.FILL01_02,
    MAIN.QTYPER_02 = TEMP.QTYPER_02,
    MAIN.QTYCDE_02 = TEMP.QTYCDE_02,
    MAIN.LTOSET_02 = TEMP.LTOSET_02,
    MAIN.TYPCDE_02 = TEMP.TYPCDE_02,
    MAIN.SCRAP_02 = TEMP.SCRAP_02,
    MAIN.ECN_02 = TEMP.ECN_02,
    MAIN.ACTDTE_02 = TEMP.ACTDTE_02,
    MAIN.FILL02_02 = TEMP.FILL02_02,
    MAIN.ALTPRT_02 = TEMP.ALTPRT_02,
    MAIN.REFDES_02 = TEMP.REFDES_02,
    MAIN.MPNSTR_02 = TEMP.MPNSTR_02,
    MAIN.MCOMP_02 = TEMP.MCOMP_02,
    MAIN.MSITE_02 = TEMP.MSITE_02,
    MAIN.UDFKEY_02 = TEMP.UDFKEY_02,
    MAIN.UDFREF_02 = TEMP.UDFREF_02,
    MAIN.XDFINT_02 = TEMP.XDFINT_02,
    MAIN.XDFFLT_02 = TEMP.XDFFLT_02,
    MAIN.XDFBOL_02 = TEMP.XDFBOL_02,
    MAIN.XDFDTE_02 = TEMP.XDFDTE_02,
    MAIN.XDFTXT_02 = TEMP.XDFTXT_02,
    MAIN.FILLER_02 = TEMP.FILLER_02,
    MAIN.CreatedBy = TEMP.CreatedBy,
    MAIN.CreationDate = TEMP.CreationDate,
    MAIN.ModifiedBy = TEMP.ModifiedBy,
    MAIN.ModificationDate = TEMP.ModificationDate,
    MAIN.ALTCDE_02 = TEMP.ALTCDE_02

    WHEN NOT MATCHED THEN
    INSERT (PARPRT_02,COMPRT_02,EFFDTE_02,FILL01_02,QTYPER_02 ,QTYCDE_02,LTOSET_02,TYPCDE_02,SCRAP_02,ECN_02,ACT DTE_02,FILL02_02,ALTPRT_02,REFDES_02,MPNSTR_02,MCO MP_02,MSITE_02,UDFKEY_02,UDFREF_02,XDFINT_02,XDFFL T_02,XDFBOL_02,XDFDTE_02,XDFTXT_02,FILLER_02,Creat edBy,CreationDate,ModifiedBy,ModificationDate,ALTC DE_02)
    Values(TEMP.PARPRT_02,TEMP.COMPRT_02,TEMP.EFFDTE_0 2,TEMP.FILL01_02,TEMP.QTYPER_02,TEMP.QTYCDE_02,TEM P.LTOSET_02,TEMP.TYPCDE_02,TEMP.SCRAP_02,TEMP.ECN_ 02,TEMP.ACTDTE_02,TEMP.FILL02_02,TEMP.ALTPRT_02,TE MP.REFDES_02,TEMP.MPNSTR_02,TEMP.MCOMP_02,TEMP.MSI TE_02,TEMP.UDFKEY_02,TEMP.UDFREF_02,TEMP.XDFINT_02 ,TEMP.XDFFLT_02,TEMP.XDFBOL_02,TEMP.XDFDTE_02,TEMP .XDFTXT_02,TEMP.FILLER_02,TEMP.CreatedBy,TEMP.Crea tionDate,TEMP.ModifiedBy,TEMP.ModificationDate,TEM P.ALTCDE_02)";




    Error Close
    mssql_query(): message: A MERGE statement must be terminated by a semi-colon (. (severity 15)
    mssql_query(): Query failed
    Error while accessing the database:
    A MERGE statement must be terminated by a semi-colon (.
    {SC_DB_ERROR_INI}View SQL{SC_DB_ERROR_MID} MERGE Product_Structure as MAIN USING Product_Structure_2016Mar171605 as TEMP ON (MAIN.PARPRT_02 = TEMP.PARPRT_02 And MAIN.COMPRT_02 = TEMP.COMPRT_02) WHEN MATCHED THEN UPDATE SET MAIN.EFFDTE_02 = TEMP.EFFDTE_02, MAIN.FILL01_02 = TEMP.FILL01_02, MAIN.QTYPER_02 = TEMP.QTYPER_02, MAIN.QTYCDE_02 = TEMP.QTYCDE_02, MAIN.LTOSET_02 = TEMP.LTOSET_02, MAIN.TYPCDE_02 = TEMP.TYPCDE_02, MAIN.SCRAP_02 = TEMP.SCRAP_02, MAIN.ECN_02 = TEMP.ECN_02, MAIN.ACTDTE_02 = TEMP.ACTDTE_02, MAIN.FILL02_02 = TEMP.FILL02_02, MAIN.ALTPRT_02 = TEMP.ALTPRT_02, MAIN.REFDES_02 = TEMP.REFDES_02, MAIN.MPNSTR_02 = TEMP.MPNSTR_02, MAIN.MCOMP_02 = TEMP.MCOMP_02, MAIN.MSITE_02 = TEMP.MSITE_02, MAIN.UDFKEY_02 = TEMP.UDFKEY_02, MAIN.UDFREF_02 = TEMP.UDFREF_02, MAIN.XDFINT_02 = TEMP.XDFINT_02, MAIN.XDFFLT_02 = TEMP.XDFFLT_02, MAIN.XDFBOL_02 = TEMP.XDFBOL_02, MAIN.XDFDTE_02 = TEMP.XDFDTE_02, MAIN.XDFTXT_02 = TEMP.XDFTXT_02, MAIN.FILLER_02 = TEMP.FILLER_02, MAIN.CreatedBy = TEMP.CreatedBy, MAIN.CreationDate = TEMP.CreationDate, MAIN.ModifiedBy = TEMP.ModifiedBy, MAIN.ModificationDate = TEMP.ModificationDate, MAIN.ALTCDE_02 = TEMP.ALTCDE_02 WHEN NOT MATCHED THEN INSERT (PARPRT_02,COMPRT_02,EFFDTE_02,FILL01_02,QTYPER_02 ,QTYCDE_02,LTOSET_02,TYPCDE_02,SCRAP_02,ECN_02,ACT DTE_02,FILL02_02,ALTPRT_02,REFDES_02,MPNSTR_02,MCO MP_02,MSITE_02,UDFKEY_02,UDFREF_02,XDFINT_02,XDFFL T_02,XDFBOL_02,XDFDTE_02,XDFTXT_02,FILLER_02,Creat edBy,CreationDate,ModifiedBy,ModificationDate,ALTC DE_02) Values(TEMP.PARPRT_02,TEMP.COMPRT_02,TEMP.EFFDTE_0 2,TEMP.FILL01_02,TEMP.QTYPER_02,TEMP.QTYCDE_02,TEM P.LTOSET_02,TEMP.TYPCDE_02,TEMP.SCRAP_02,TEMP.ECN_ 02,TEMP.ACTDTE_02,TEMP.FILL02_02,TEMP.ALTPRT_02,TE MP.REFDES_02,TEMP.MPNSTR_02,TEMP.MCOMP_02,TEMP.MSI TE_02,TEMP.UDFKEY_02,TEMP.UDFREF_02,TEMP.XDFINT_02 ,TEMP.XDFFLT_02,TEMP.XDFBOL_02,TEMP.XDFDTE_02,TEMP .XDFTXT_02,TEMP.FILLER_02,TEMP.CreatedBy,TEMP.Crea tionDate,TEMP.ModifiedBy,TEMP.ModificationDate,TEM P.ALTCDE_02){SC_DB_ERROR_CLS}Close{SC_DB_ERROR_END }



    HA! We're all just a little crazy.

  • #2
    mssql_query(): message: A MERGE statement must be terminated by a semi-colon !!

    last line :

    tionDate,TEMP.ModifiedBy,TEMP.ModificationDate,TEM P.ALTCDE_02);";

    Comment


    • #3
      Originally posted by Jens Bookhagen View Post
      mssql_query(): message: A MERGE statement must be terminated by a semi-colon !!

      last line :

      tionDate,TEMP.ModifiedBy,TEMP.ModificationDate,TEM P.ALTCDE_02);";
      Thanks for the reply Jens, but when I try it that way I get:

      Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in
      HA! We're all just a little crazy.

      Comment


      • #4
        php-strings ..... try to escape like tionDate,TEMP.ModifiedBy,TEMP.ModificationDate,TEM P.ALTCDE_02)\;";

        better fo using long sql statements is :


        $sqlstring = <<<END_OF_SQLSTRING
        put you sql here after testing in sqleditor
        ENDE_OF_SQLSTRING;

        sc_exec_sql(addslashes($sqlstring);

        may be sc_exec_sql is using addslashes by default

        Comment


        • #5
          This problem was solved. The problem was not the semicolon, as is, but a mix of others circunstances
          /Giuseppe

          Professional Scriptcase Services
          Some Customers opinions

          Comment

          Working...
          X